fixed memory leak of timer

Fixed a memory leak