Closing Box?

I added a button with an onclick refresh page as well as a provision that the popup does NOT occur if someone clicks on that page from an internal page.

Well, the popup box's submission does work, and the refresh command works, but 1) It takes a while and 2) the pop-up box occurs again.

So, do you have a better solution I could use to get rid of the pop-up box on a button? I tried onclick.windowclose but it didn't work properly. It redirected the user to another page instead of closing JUST the popup.