Quote
What about if this is sent after 321:

//sockwrite -nt testSock :fake.name 322 $mnick #somechan 1 :[+nt]

That makes no difference here. I am still able to delete the channels.txt file after I click the disconnect button or use /disconnect.

If I try to delete the file before I click the disconnect button or /disconnect, explorer tells me the file is opened in mIRC.

The file is opened the moment a 321 or 322 is received, so it is locked at that point and only unlocked on a 323 or a disconnect.