Fix NoneType exception when cancel timer