Yes, something along those lines. However you should still check that $sock($sockname).sq == 0 before closing because ON SOCKWRITE can trigger in different conditions:
The sockwrite event is triggered when mIRC has finished sending all of the data that you previously queued for sending or when the socket is ready for more writing.