Better handling of timer on close