code: def close(self):
          
          publish = False
          exporterid = rsid = exception = export_ref = ed = None
          with self.__lock:
              if not self.__closed:
                  exporterid = self.__exportref.get_export_container_id()
                  export_ref = self.__exportref
                  rsid = self.__exportref.get_remoteservice_id()
                  ed = self.__exportref.get_description()
                  exception = self.__exportref.get_exception()
                  self.__closed = True
                  publish = self.__exportref.close(self)
                  self.__exportref = None
  
          # pylint: disable=W0212
          if publish and export_ref and self.__rsa:
              self.__rsa._publish_event(
                  RemoteServiceAdminEvent.fromexportunreg(
                      self.__rsa._get_bundle(),
                      exporterid,
                      rsid,
                      export_ref,
                      exception,
                      ed,
                  )
              )
              self.__rsa = None
docs: Cleans up the export endpoint