18" Shotgun 12, 16, or 20 Gauge
A long gun is MUCH easier to hit with than any handgun.
A short-barreled shotgun is pretty much ideal for a stationary defense scenario. (Call for backup, stay safe and protect that which cannot be replaced or insured - e.g. your life and limb and those of your loved ones.)
Shotgun has a lot more instant stopping power than any handgun round, and less overpenetration, too.
Readily available in the $300 range.
No one in their right mind,after hearing a pump shotgun's action close on a full chamber on the other side of a closed door will open that door if there is another exit.
Now, having said all that, I am a fan of handguns and enjoy the sport of target shooting and keep one for self defense. So, you take your compromises where you will, as have I.