Think of how most programs you run behave. Do you often have apps that close main windows and open others all the time? Or is it more common for the app to show different screens on the same app when the app's state changes, or in other situations, show a main window and then open dialog windows when necessary?
I believe that you are significantly limiting your program's design options by coding to the JFrame. You are far better off to strive to code to a JPanel rather than a root container such as a JFrame. If you create a GUI that's based on a JPanel, then you have the freedom of displaying it in a JFrame or if you'd prefer a JDialog, or a JApplet, or as in this case a JDialog.
So the bottom line (in my opinion) is to not let the limitations of your design dictate how your app will run. Free your design up with JPanels and use a CardLayout. Notice that this opinion is shared by many here in this
thread who are much smarter than me, one a moderator and the other an author of Java texts.
As long as I'm on a soapbox, let me tell you how I think use of NetBeans-generated code actively hinders a student's ability to learn Swing and how your very problem is an example of this,... but if I get started, I might not be able to stop! To cut this short, my other recommendation is for you to not use NetBeans to generate your code but instead to go through the Swing tutorials (a link was provided above). You'll not regret this if you do it.