'Close port'

def close(self):

    if self.is_open:
        if self._port_handle:
            try:
                self._port_handle.Close()
            except System.IO.Ports.InvalidOperationException:
                pass
            self._port_handle = None
        self.is_open = False
