I recommend separating this into two separate parts: presence and sensing.
For the presence detection part see Generic Presence Detection which shows a way to aggregate more than one presence detection sensor into one sate, with a five-minute timer to avoid flapping. I suggest this as I suspect you will care about presence elsewhere in your rules and most people find that just using Network is not sufficient for presence detection given how phones go into a deep sleep these days.
After that the rule is pretty much like Udo wrote. I’ll present an alternative implementation using Expire Binding instead of Timers.
Switch DoorTimer { expire="5m,command=OFF" }
rule "Door closed"
when
Item Door changes from OPEN to CLOSED
then
DoorTimer.sendCommand(ON)
end
rule "Door timer went off"
when
Item DoorTimer received command OFF
then
if(gPresence.state != ON) gMyLights.members.filter[l|l.state != OFF].forEach[l|l.sendCommand(OFF)]
end