fix pruneEmptyDirectories for modules that are single files

this should fix JENKINS-20317