code: def close_active_window(self):
          
          active_split = self._get_active_split()
  
          # First remove the active window from its split.
          index = active_split.index(self.active_window)
          del active_split[index]
  
          # Move focus.
          if len(active_split):
              new_active_window = active_split[max(0, index - 1)]
              while isinstance(new_active_window, (HSplit, VSplit)):
                  new_active_window = new_active_window[0]
              self.active_window = new_active_window
          else:
              self.active_window = None  # No windows left.
  
          # When there is exactly on item left, move this back into the parent
          # split. (We don't want to keep a split with one item around -- exept
          # for the root.)
          if len(active_split) == 1 and active_split != self.root:
              parent = self._get_split_parent(active_split)
              index = parent.index(active_split)
              parent[index] = active_split[0]
docs: Close active window.