Make sure Cleaner doesn't remove dirs if they only contain subdirs

Closes #2204
Keep parents of directories in keep_files

Closes #1297
Using implicit returns to conform to coding style
Merge pull request #2458 from karouf/cleaner-empty-dirs