When your key doesn’t work in the door, then it’s time to come out of your autopilot trance and look at the apartment number. That was her fatal mistake.
His mistake was opening the door before clearly understanding who was there. Never do that in a big city building - that is what peepholes, video cameras, and intercoms are for.
Had he looked through the peephole, or even peeked over a chain, he would have seen an officer in uniform. Most people would have opened the door at that point.