code: def close(self, clear=False):
          
  
          if clear and not self.leave:
              self.clear()
          else:
              self.refresh()
  
          self.manager.remove(self)
docs: Do final refresh and remove from manager
  
          If ``leave`` is True, the default, the effect is the same as :py:meth:`refresh`.