I think there's one issue with this code. There maybe multiple writes may happen by the time `hash` will be updated. On windows it
will probably fail because file descriptor will be open. I think it'll be better if write would schedule writing rather than actually do it. That
way after end of the `fs.writeFile` completes callback can see if new write is scheduled, if so redo the writing. Of course write will start
write if scheduler is not active.