I've noticed this several months ago, but couldn't figure out what was triggering it. Turns out that it is triggered as Jigsy reports, where 'unable to join' is causing the window to close.

It had been happening intermittently, and I assumed that somehow the channel window was closed due to some kind of $network mis-match during ON CONNECT. But I see now that in my case, it's triggered by a bug in the older Unreal ircd which doesn't allow me to join a +R channel even though I'm identified to nickserv. In this example I identify to nickserv via SASL EXTERNAL, but because maroon2 is not linked to the maroon account, it's not letting me join the +R channel, but that is causing mIRC to close the #channel window, which hadn't been happening in older versions.

[10:45:03] Welcome to the SwiftIRC IRC Network maroon2!userid@my.ipv4.address
...
[10:45:03] * maroon2 sets mode: +ixz
[10:45:03] staff.mircscripts.info is now your displayed host
[10:45:05] -HostServ- Your vhost of staff.mircscripts.info is now activated.
[10:45:05] -NickServ- SSL certificate fingerprint accepted, you are now identified to maroon.
* Skipping autojoin of channels...
[10:45:03] * maroon2 [abcdefghij@staff.mircscripts.info] is on IRC
[10:45:23] #martoon unable to join channel (not using registered nick)

Note:

1. The timestamp backtracks because the server-time setting keeps sending the @time= tag even if I've done "/cap req -server-time".

2. The 20 sec gap between connecting and trying to join the +R channel appears to be caused by having "/autojoin -s" in perform-on-connect, even though I didn't use the -dN switch. If I disable perform-on-connect, everything behaves the same way except there's no longer a 20 sec delay before failing to join the +R channel closes the channel window.