You can try this in the body tag.
Not sure if it will work in all browsers.
It "should" close the window if a viewer
clicks outside of the popup.
However it takes a positive action by the viewer,
as the pop-up retains focus until the viewer does
"something" with the keyboard or mouse.
<body onfocusout="parent.close()"