the simplest way to do something like this is to use zone.home. this is a zone that’s already created by home assistant and it’s state is a number that tracks how many people are at home. take a look at it in your dev-tools->state.
then to use this, use the numeric_state trigger. trigger when the numeric state becomes < 1, to signal that no one is home and you can close up. trigger when the numeric state becomes > 0 to signal that someone has arrived home.
My suggestion though, for a more timely triggering when you leave home (since you want the house locked up ASAP I would imagine) is to use a device tracker on your home wifi network. When your phone is no longer connected to the house wifi, that means you aren’t home, and the routine runs. Much faster than waiting for GPS to update.
In any event, if you’re having trouble with the automation, I’d check your phone to ensure location services are configured properly for the app.