Stops the timer.

def stop(self):
        """
        Stops the timer.
        """
        self._lock.acquire()
        try:
            # Stop the timer
            if self._timer != None:
                self._timer.stop()
                self._timer = None
            
            # Unset started flag
            self.started = False
        finally:
            self._lock.release()