Ensure initFile is fully flushed

* Wait until initFile has been fully written before calling done
* Remove dependency on mkdirp