listen to writeStream 'end' event instead of 'finish'