Sometimes temporary directories were not being deleted