Merge pull request #6 from pvenkatakrishnan/master

Fixing the promise resolution only after the writestream has finished.
Merge remote-tracking branch 'upstream/master'