Clean up the mess that handles terminating processes.