Wait for the process termination