Fixed shutdown logic on buttonpress

Moved the shutdown into a function since it needed to happen both for a
timer expire as well as for a button press "off".
Not really sure what these are used for

Not really sure when these showed up or what they are for.  FIgured I'd
sync them up though just in case.