Closes the device.

def close(self):
        """
        Closes the device.
        """
        try:
            self._running = False
            self._read_thread.stop()
            self._device.close()

        except Exception:
            pass

        self.on_close()