Wait for scripts to finish before restarting them.