Beg to differ. If you are armed. There was a recent case here in Georgia where an Amish man broke into a house in a secluded neighborhood. He was armed with a crowbar - the mother ran upstairs and hid with the children in an attic closet. Accounts you hear say that the perpetrator only had robbery on his mind, yet he followed the young mother upstairs with her children.... to do what? RAPE - that's what. Only, she had her phone and a 38 revolver with her. She got him 5 times. The lucky would-be rapist lived, but he was over and done when she popped him...inside the closet.
But, but a popular home safety book from 45 years ago said your should go into a “safe room”, break apart a pair of scissors and tape the blade to a broomstick!
She had no alternative as she was trapped in a small enclosure.
NEVER (if you can help it) trap yourself thus because the bad guy may just have a gun (YOU DON’T KNOW FOR SURE) and could just pump shots into that closet and there is no where to hide.
Last resort choice ONLY.