code: def close(self, _force_lock=False):
          
          if not self.closed:
              with self.__force_lock(_force_lock) or self._serial_lock:
                  self._serial.close()
                  self.__used_ports.remove(self.port)
  
              logger.info("Closing port '%s'", self.port,
                          extra={'port': self.port,
                                 'baudrate': self.baudrate,
                                 'timeout': self.timeout})
docs: Closes the serial communication if opened.