Hello Taifun, thanks for replying to my issue. My next step was to investigate if I could use the error to detect a disconnection. In fact I came across something similar in a few google searches. I will try this method and update this post thereafter. Before doing so though, I am a little confused as to why the solution suggested by ABG in a previous comment (this one) worked for them but did not work for me. When you say:
do you mean that this solution worked previously but for AI2 it does not or did I do something wrong when incorporating that solution into my program?