newdb: Fix deleting empty records leaving behind a temp dir