I am writing a python program which executes the following sequence:
1. Dialog box to open/select a directory
2. perform certain operations
3. rename the file using a tkinter dialog box
4. Perform rest of the operations  
I have written the following code:
def open_directory():
    directory_name = filedialog.askdirectory(title='Ordner Auswählen',parent=root)
    print(directory_name)
    root.destroy()
def input_name():
    def callback():
        print(e.get())
        root.quit()
    e = ttk.Entry(root)
    NORM_FONT = ("Helvetica", 10)
    label = ttk.Label(root,text='Enter the name of the ROI', font=NORM_FONT)
    label.pack(side="top", fill="x", pady=10)
    e.pack(side = 'top',padx = 10, pady = 10)
    e.focus_set()
    b = ttk.Button(root, text = "OK", width = 10, command = callback)
    b.pack()
def close_window():
    root.destory()
root = tk.Tk()
root.withdraw()
open_directory()  #dialogue box to select directory
<perform certain operations>
input_name()  #dialgue box for user input file name
root.mainloop()
close_window() #exit the mainloop of tkinter
<perform rest of the functions>
but I get the following error
Tclerror: NULL main window
I think it is realted to declaring root as the main window, but I dont seem to find where I have made the mistake.
Is there some other method, which is better, for what I am trying to do here?