There's no way to refresh mIRC's connection IDs because it would defeat the object of having connection IDs. You would have to restart mIRC. But that won't fix anything because the error will inevitably happen again so it's not benefiting anyone to pretend it doesn't exist. As I already explained connection IDs refer to the Status Window and not the connection itself, meaning that disconnecting before closing a status window is entirely irrelevant to the problem.
As I have also said at least once in this thread, nobody else experiences this problem. If hundreds of thousands of people use an application and only a single person has a problem which is an error message from a scripted command, what's the logical first place to look for the cause? It doesn't mean that it's impossible that there's a problem with mIRC but you're apparently not even willing to take basic steps to debug your script. You won't display the script so we can find the error, won't edit the script to help you find the error, seemingly won't accept any kind of answer that doesn't involve mIRC being at fault.