These are not quite equivalent situations to OP, so take it for what it's worth.
When I was growing up, our cats lived in the unfinished part of the basement. There was a door with a grate separating cat territory from human territory. The cats were not allowed through the door unless they were carried through it (and then kept on laps the entire time). They did, however, have a cat door so they could come and go as they chose.
To keep the cats (and the rotating cast of kittens) in the cat rooms, I would keep one leg in front of the opening door, blocking it, and as soon as the door was open wide enough, I'd push my leg through in a sweeping motion. Ninety percent of the time, that took care of anyone wanting to escape. Before exiting, any cat or kitten showing too much interest in the door would get the Stop Hand - I would hold my flat hand in front of the cat's face and push them gently. All of the adult cats, and most of the kittens, eventually decided that the doorway was an uncrossable barrier. I once came downstairs to discover that someone had left the door open, and the cats were all lined up on their side, facing the door, looking out.
My current Tailsome Twosome went through a phase where, after respecting the not-in-the-bedrooom rule for almost a year, they ganged up on me to make sure they got to sleep with me at night. I ended up caving, because it would take me half an hour or longer to get both of them on the living room of the door and me on the bedroom side of the door. They have also gradually become more and more interested in leaving behind their indoor-cat lives and venturing as far as the entrance. To keep them inside the house, I use airlock principles: I don't open the door from the house proper to the entrance unless the doors to the Big Green Room are closed, and I don't open the outside doors until I'm certain that the entrance is cat-free.
So far, no escapes.