If you opened the safehouse in your hideout the game will (or should) warn you that the safehouse will be locked if you were to leave. Seems like the warning is missing on certain circumstances. Next time, don't go to town nor anywhere but your own hideout.