Fix bug in outputCollectionToFile that mkdirs the current directory