Fixing the promise resolution only after the writestream has finished.