This sounds supiciously like a JavaScript question, but I will try to help.
In order to close the script on a form submission, you must set the onSubmit handler (in the <form> tag)
Like this :
<form name="form1" method="post" action="" onSubmit="window.close()">
I am looking into how to refresh the parent window after sich an action...
I will post again soon with that for you.