Simply When you open new windows assing it to variables.
<script language=javascript type=text/javascript>
var win1;
var win2;
var win3;
function openNewWindow()
{
win1 = window.open("page1.aspx");
win2 = window.open("page1.aspx");
}
function CloseChildren()
{
win1.close();
...........
}
then in body onunload event call CloseChildren()
Note: each new window must assign to diffrent variable then check them all
if not null (NaN) They close it..