Fix a thread leak in timer task

I'm not sure if this will work but I think it will