The lock has a flashing red light if wrong key fob is inserted.
Yeah, so you think it’s broke, etc. Takes a second or two for that red flashing light, that key that won’t turn, or whatever to turn into a realization that you are at the wrong apartment door.
My experience is that these electronic keys frap out a lot, either becoming “maybe-ish” or not working at all. So, she’s dead tired (who knows what she did B4 going to work, and fatigue can even cause hallucinations - I’ve driven myself to very mild such a few times myself.) Attempts with key at door rouse victim, he makes some sort of noise, officer (still thinking apt. is hers) draws weapon - recipe for disaster, and it happened.
That is pure speculation - the actual sequence may be far more “interesting”. Not that it should have happened!