Trying to turn off an output 1second after a switch is tripped

Or,

if (latch) {
...
}