“Would it have been possible to have retreated into a bedroom and locked the door until police arrived?”
You do realize the average apartment interior door is more privacy curtain than door don’t you?
First rule of life...Don’t do stupid things.
Second rule of life...If someone does stupid things that threaten the safety of you or others, use whatever force necessary to end the threat.
Per the article the apartment dweller fired two rounds and stopped. The third round was fired when the soon to be dead idiot kept advancing. I would have emptied the magazine (or cylinder if a revolver) and quickly reloaded.