I can't reproduce any problems with the above script here, no dialogs trails, etc. That said, when you use $com() to call external objects, mIRC has no actual control over how they work, or how they might affect mIRC itself.
Right, I was able to reproduce this. There is nothing that can be done in mIRC to prevent this since the routine you are calling has complete control at that point. The solution is to use the multithreaded version of $com which is $comcall().