Trap process quit and termination