wait for async writes to finish