well i guess you could have:

on *:disconnect:partall

that would close all channels when you disconnect from a server, but there is also an option in mirc options that will allow you to close channel windows when a new connection attempt is made, this might be checked, alt O > IRC > keep channels open.