Delete empty directories when record is deleted

Fixes #1