Is there a default option to close a jQuery dialog by clicking somewhere on the screen instead of the close icon?
If the code of the previous posts doesn't work, give this a try:
$("a.ui-dialog-titlebar-close")[0].click();