how to close a popup?

hey all,
I open a popup from a firefox extension with
The content of the popup is a regular form with a text_field to fill.
Is there a way to automatically close the popup after the user click
the form's submit button?

thanx in advance