You gain brief invincibility when leaving/entering rooms. Sorry about that though, I think if I were to expand upon this I would make them wonder away from the door ways when you leave a room.