Im writing a new script for my bouncer, but I had a problem with closing the channel window...

If im connected to a server via a bouncer, and the bouncer gets disconnected from the server, i wanted a way of closing the channel windows:

the /close function doesn't support channel windows and the /part function wont work because it says im not on the channel even though the window is open.

any suggestions?