mkdirp before opening file stream