Wait for streams to be finished before task ends; or sync promises and streams