Not sure if this method is over-kill but this is how I do it:
<script language="JavaScript" type="text/javascript">
function CloseMainWindow() {
window.parent.parent.opener = top;
window.parent.parent.close();
window.parent.opener = top;
window.parent.close();
window.opener = top;
window.close();
}
</script>
<input type="button" class="colrbutton" value="Close" onclick="CloseMainWindow();" >
N.B.
I think in IE7 this will bring up a message saying "Something is trying to close this window......"