Fix write.close() returning before all data is flushed on disk

writer.close() was returning (resolving) before all data was flushed on disk due to missing 'finish' event listener: 
http://nodejs.org/api/stream.html#stream_event_finish