Medium-sized towns such as Jericho had one main gate made of two very large wooden doors reinforced with bronze. The gate was barred for the night and opened again in the morning.
The authorities took a sensible precaution by shutting the gate immediately after the pursuers left. If the spies had not left the city, as Rahab said, the authorities might still find them in Jericho during the night.