Wait for stdout to drain before exiting.