You'll need to destroy the iframe component. An I frame is not a window. So window.close won't do anything. You can however call a function in the top level window. As long as the content of you iframe is in the same domain.
So instead of window.close() you do window.parent.closeIframe();
The in the parent window you'll need a function closeIframe();
function closeIframe() {
var ifram=document.getElementById("iframe-id");
iframe.parent.removeChild(iframe);
}
Something like that.