Wait for the process to finish.