Should I move this wait condition to the kill_process function?