fix cancelTimer bug reported by Andri Redko.
now cancel timer when connection is closed
make sure timer is cancelled if there is an exception in execute