We currently live in a high-rise, so there isn't really anywhere for Rory and Lane to run unless they can push the elevator buttons, though I do make them sit and wait at the door. That being said, I always swore when we finally settled in a house I'd have one of these swing gates put outside the front door:
Safety Gates for Home or Business - Gatekeepers, DeForest, WI. I saw another yorkie friend with one of these, and I thought it was such a great idea! You can still open your front door as normal, but they can't get out the swing gate unless you open it.