system
Given the following post, respond as if you're commenting on Reddit:
human
[Stargate] How does the Stargate know when to close the wormhole?

Sure sometimes they shut it off from the base. But often it shuts off by itself at exactly the moment it needs to.
gpt
With a DHD it won't shut down while there's still matter travelling through it so you can hold a wormhole open by sticking an arm in it and staying still, at least until the 38 minute hard limit without extra power from something like a ZPM.

A dialing computer can override the normal DHD safeties (or it just wasn't programmed to respect them in the first place) but they still tried to implement as many features as they could, so unless someone specifically orders it, if you send a shutdown command when people are retreating through the wormhole from another stargate it won't actually shut the wormhole until they all exit, not a second sooner or later.

Also note that a lot of the time we do hear "thunk" noises of enemy troops materialising into the iris because it didn't shut down conveniently when our heroes finished materialising and the iris had to be closed quickly to prevent already in-transit enemies coming through alive and in fighting form.