Fixes #2 updates timer state before closing window