Does she ever go out at all on her own? If not, it might be time to deadlock the door when she is inside on her own so she can't physically get out.
I'm only thinking aloud here and I don't know if this has repercussions in terms of her becoming distressed because she couldn't open the door, but recently I've been thinking how I would handle the situation if my aunt had a sudden decline and started wandering.
At the moment, although she walks (shuffles) very slowly and has difficulty climbing steps and maintaining balance, she is determined to carry on going on the bus 4 or 5 times a week to go shopping and visit my mum. Last week, she lost her Santander debit card at some point before arriving at mum's and when I got there she was determined to go up to the high street and sort out a replacement with Nationwide, despite us both trying to explain that Nationwide and Santander are different.
I was concerned she would just end up wandering aimlessly around the high street and get lost, but she would not be talked out of going up there and began to get quite agitated when we tried to distract her and convince her to stay in the house so I could sort it all out for her on the phone.
In the end, I had to let her go otherwise I think she would have become aggressive with us and more distressed. I ended up following her to make sure she was OK and watched her go to Nationwide, Nat West and Barclays (she doesn't have an account with any of them) and then back to Nationwide, where I 'bumped into her' and convinced her to come back home with me.
It was one of the few times I've felt really unsure what was the best course of action to take but if she starts to become a real danger to herself I think I'll have no option but to lock the front door and stop her from leaving. I'd probably then have to try some sort of subterfuge such as "oh dear, the lock's broken", or "the door's stuck, it does that when it's cold" and hope she doesn't realise what we've done.
My aunt won't consider care or help at the moment, so this wouldn't be an easy step to take by any means but ultimately I feel it's best to do whatever is required to keep someone safe at that particular time and deal with the fall out later.