code: def close(self):
          
          if self._loop is None:
              return
          if fibers.current().parent is not None:
              raise RuntimeError('close() may only be called in the root fiber')
          elif compat.get_thread_ident() != self._thread:
              raise RuntimeError('cannot close() from a different thread')
          self._closing = True
          self._interrupt_loop()
          # Note how we are switching to the Hub without a switchback condition
          # being in place. This works because the hub is our child and upon
          # a child fiber exit its parent is switched in.
          self.switch()
docs: Close the hub and wait for it to be closed.
  
          This may only be called in the root fiber. After this call returned,
          Gruvi cannot be used anymore in the current thread. The main use case
          for calling this method is to clean up resources in a multi-threaded
          program where you want to exit a thead but not yet the entire process.