minor: making a directory before trying to write files to it