Sort:  

It's likely just some incomplete node change code. :P

It does the same on my end. If the API node closes connection it tries to change node but doesn't always work properly.

Is that a script issue or just the way things are?

Improper error handling / bad function logic.

The script is just a quick edit of some old old steem era script I made back when I wasn't quite as advanced coding wise as I am now. I'll update the code here later tonight to try and implement a fix for the issue.