Err, in that case you should use
on [color:red]^[/color]*:open:?:{
if (!$IsFriend($nick) && $AcceptFromFriendsOnly) {
[color:red].msg[/color] $nick Sorry $nick $+ , But I'm Busy ATM!
[color:red]halt[/color]
}
}
to stop the window opening completely, rather than opening/closing it.