writes to file after each coroutine has finished