How do you make a frame shut down without the close button?

I just started to learn Lua, and the first thing i tried to make after reading the tutorials was a menu in which you choose what class you want to spawn as, and it works fine except when I click the button the frame doesnt close and just stays there, making me unable to play. maybe someone could explain to me how to do what im trying, or at least give a similar example, thanks.