made _writeFile asynchronous too