Leaving home wifi triggers garage closure

Simplest way is to use a routine like @Benji pointed out.

If you are looking for more advanced features to open / close the garage door (delayed timers etc) and you have access to RBoy Apps then check out the Garage Door Open/Close SmartApp