:return:
            a function wrapping ``handler`` to cancel timeout event

def augment_on_close(self, handler):
        """
        :return:
            a function wrapping ``handler`` to cancel timeout event
        """
        def augmented(ex):
            try:
                if self._timeout_event:
                    self._scheduler.cancel(self._timeout_event)
                    self._timeout_event = None
            # This closing may have been caused by my own timeout, in which case
            # the timeout event can no longer be found in the scheduler.
            except exception.EventNotFound:
                self._timeout_event = None
            return handler(ex)
        return augmented