More functions for one file

In a I coded my whole script where some functions share the same .csv file.
I’m trying to undestand if this could cause a logical error that occurs when I run the code.
The script use a tkinter GUI, so I created a frame for all the functions; to close them, I created a button for closing the frame. As a newbie, I’m not sure to get it properly, because I guess to close only the graphical frame and not to exit from the function. So, my doubt is that the informations about the opened functions still stay in ram also if I close the frame.
Is it correct? If yes, how can I exit the function in the same time I close the frame?

Can you provide some code? It could be just a simplified example.

If you do, please wrap it in backticks to preserve the formatting; you can do that by selecting the code and clicking the </> button.

It would be already quiet well explained, anyway…
Assuming that there is a function of your choice, with a tkinter GUI and a frame that contains each element you need for having a graphical interface for that function…

    def close_function():

So, my question is: this would close only the graphical element without really exit the function?
If yes, how can I exit the function from ram?