docs: def close_document(self, path):
          """
          Closes a text document.
          :param path: Path of the document to close.
          """
          to_close = []
          for widget in self.widgets(include_clones=True):
              p = os.path.normpath(os.path.normcase(widget.file.path))
              path = os.path.normpath(os.path.normcase(path))
              if p == path:
                  to_close.append(widget)
          for widget in to_close:
              tw = widget.parent_tab_widget
              tw.remove_tab(tw.indexOf(widget))