If this is pertaining to greybox from Orangoo...
And if you have adapted it for ajax (by the sounds of it), then what about adjusting the javascript to call the close function after the query has been made?
Better to google greybox I would have thought...
or browse the provided forum
http://groups.google.com/group/greybox