You may want a Context based on the State "Wifi Near". I think you'd enter your SSID or router MAC and click the "Invert" checkbox. Theoretically, this would trigger when wifi is enabled and it no longer sees your router. The task, of course, would be to set Wifi to off.
If that doesn't work...