If you didn’t already think allowing guns on planes was a dumb idea, this ought to convince you.
Bullets have been known to kill people. If such a person happens to be in the cockpit, the plane could crash. Bullets have also been known to depressurize planes. If said bullet pierces the cabin, the plane may not crash but will certainly need an emergency landing. If the bullet simply got lodged somewhere but the shot occured at a critical phase of flight (um, landing, for instance), the distraction could cause the pilots to crash.
A Kevlar-reinforced flight deck door is plenty. Allowing guns on plane is a dumb idea. Dumb, dumb, dumb. The pilot in this case should be terminated.