Handle process termination