Pilot error. The pilot has no business "leaving the cockpit" while he's trying to fly the plane
The correct sequence is (1) land the plane, (2) when the plane has taxied and come to a complete stop, secure the firearm, (3) exit the cockpit
That sounds right. Unless there are yet more rules preventing it.
The idea of a pilot stowing a handgun while handling a landing is not at all comforting.
Yeah, he should just "hold it" for another five hours, if he needs to pee.