Waiting for process to stop