added fix for infinite rmdir loop

Signed-off-by: Brian White <mscdex@mscdex.net>