code: def closing_plugin(self, cancelable=False):
          
          self.findinfiles.closing_widget()  # stop search thread and clean-up
          options = self.findinfiles.find_options.get_options(to_save=True)
          if options is not None:
              (search_text, text_re,
               exclude, exclude_idx, exclude_re,
               more_options, case_sensitive,
               path_history) = options
              hist_limit = 15
              search_text = search_text[:hist_limit]
              exclude = exclude[:hist_limit]
              path_history = path_history[-hist_limit:]
              self.set_option('search_text', search_text)
              self.set_option('search_text_regexp', text_re)
              self.set_option('exclude', exclude)
              self.set_option('exclude_idx', exclude_idx)
              self.set_option('exclude_regexp', exclude_re)
              self.set_option('more_options', more_options)
              self.set_option('case_sensitive', case_sensitive)
              self.set_option('path_history', path_history)
          return True
docs: Perform actions before parent main window is closed