Proper termination handler