Change how the poweroff timeout is handled.

Previously, if you pressed the power switch and release it in
the moment, then wait ~2 seconds and press it again, the device
was powered off. This commit fixes this issue.