```
class MatchingFilesDialog(tk.Toplevel):
    def __init__(self, master, input_path, matches):
        super().__init__(master)
        self.master = master
        self.input_path = input_path
        self.matches = matches
        self.tree = None
        self._create_ui()
        self._populate_initial_data()
        self._start_background_tasks()

    def _create_ui(self):
        self.title("Duplicate Matches")
        self.resizable(True, True)
        self.master.center_window(self, 800, 400)

        content_frame = ttk.Frame(self, padding=10)
        content_frame.pack(fill=tk.BOTH, expand=True)

        input_label = ttk.Label(content_frame, text=f"Input file: {os.path.basename(self.input_path)}")
        input_label.pack(anchor=tk.W, pady=(0, 5))

        parent_frame = ttk.Frame(content_frame)
        parent_frame.pack(fill=tk.X, pady=(0, 10))

        parent_label = ttk.Label(parent_frame, text="Parent folder:")
        parent_label.pack(side=tk.LEFT)

        parent_path = os.path.dirname(self.input_path)
        parent_path_label = ttk.Label(parent_frame, text=parent_path)
        parent_path_label.pack(side=tk.LEFT, padx=5)

        parent_browse = ttk.Button(parent_frame, text="Browse", command=lambda: open_folder(parent_path))
        parent_browse.pack(side=tk.LEFT)

        tree_frame = ttk.Frame(content_frame)
        tree_frame.pack(fill=tk.BOTH, expand=True)

        columns = ("basename", "size", "murmurhash")
        tree = ttk.Treeview(tree_frame, columns=columns, show='headings')
        self.tree = tree

        tree.heading("basename", text="Basename")
        tree.heading("size", text="File Size")
        tree.heading("murmurhash", text="MurmurHash")

        tree.column("basename", stretch=True, anchor=tk.W)
        tree.column("size", width=100, minwidth=100, stretch=False, anchor=tk.CENTER)
        tree.column("murmurhash", width=150, minwidth=100, stretch=False, anchor=tk.CENTER)

        y_scrollbar = ttk.Scrollbar(tree_frame, orient=tk.VERTICAL, command=tree.yview)
        x_scrollbar = ttk.Scrollbar(tree_frame, orient=tk.HORIZONTAL, command=tree.xview)

        tree.configure(yscroll=y_scrollbar.set, xscroll=x_scrollbar.set)

        tree.grid(row=0, column=0, sticky='nsew')
        y_scrollbar.grid(row=0, column=1, sticky='ns')
        x_scrollbar.grid(row=1, column=0, sticky='ew')

        tree_frame.grid_rowconfigure(0, weight=1)
        tree_frame.grid_columnconfigure(0, weight=1)

        tree.bind("<Double-1>", lambda event: self.on_dbclick_tree(event, tree, parent_path))

        button_frame = ttk.Frame(self, padding=10)
        button_frame.pack(fill=tk.X, pady=5)

        ok_button = ttk.Button(button_frame, text="OK", command=self.destroy)
        ok_button.pack()

    def _populate_initial_data(self):
        for dup_basename, _, dup_full_path in self.matches:
            self.tree.insert("", tk.END, values=(dup_basename, "Calculating...", "Calculating..."))

    def _start_background_tasks(self):
        thread = threading.Thread(target=lambda: self._compute_hash_and_size(0))
        thread.start()

    def _compute_hash_and_size(self, index):
        # Base condition: when the index reaches the length of matches
        if index >= len(self.matches):
            return

        dup_basename, _, dup_full_path = self.matches[index]

        try:
            # Try to open the file and read its content
            with open(dup_full_path, 'rb') as f:
                content = f.read()

            # Compute the MurmurHash from the file content
            hash_value_int = mmh3.hash(content, seed=0)
            hash_value = hex(hash_value_int & 0xFFFFFFFF)

            size = os.path.getsize(dup_full_path)
            human_readable_size = self.get_human_readable_size(size)
        except FileNotFoundError:
            # Handle the specific case where the file does not exist
            human_readable_size, hash_value = "Not Found", "N/A"
        except Exception as e:
            # Handle other potential file access or reading errors
            print(f"Error processing {dup_full_path}: {e}")
            human_readable_size, hash_value = "Error", "Error"

        # Update the tree view item
        self.tree.item(
            self.tree.get_children()[index],
            values=(dup_basename, human_readable_size, hash_value)
        )

        # Schedule the next update
        self.tree.after(
            100,
            lambda: self._compute_hash_and_size(index + 1)
        )

    @staticmethod
    def on_dbclick_tree(event, tree, parent_path):
        region = tree.identify("region", event.x, event.y)
        if region != "cell":
            return
        row_id = tree.identify_row(event.y)

        if not row_id:
            return

        basename = tree.set(row_id, "basename")
        file_path = os.path.join(parent_path, basename)
        if os.path.exists(file_path):
            highlight_files(file_path)
        else:
            messagebox.showerror("File Not Found", f"The file '{file_path}' does not exist.")

    @staticmethod
    def get_human_readable_size(size, decimal_places=2):
        for unit in ['B', 'KB', 'MB', 'GB', 'TB']:
            if size < 1024.0:
                return f"{size:.{decimal_places}f} {unit}"
            size /= 1024.0

```

rewrite this such that the window is memoized.
e.g. calling  `MatchingFilesDialog(root, 'foo', whatever)` once creates the window and focus on it. call it again would just bring the window to the front if its not destroyed. if its destroyed, create the window and focus on it.
basically you memoize `master, input_path` to a weak window reference
the reference is invalid upon window closed/destroyed