Deleting stale Postgres wal files

I was debugging a system earlier today, where one of the postgres instances ran out of disk space, and taking a closer look at the system, I realised that the backup command was failing silently, but the postgres archive files was still being retained in the wal folder.

Checking a bit at the document, found that they can be deleted using:

pg_archivecleanup -d /var/lib/postgresql/wal/pg_wal 000000010000003700000010.00000020

Hope it helps someone or even me in future :)