That problem is easily avoided by wrapping the whole script in a function and then calling it on the last line.<p>It looks like Patchwork&#x27;s script doesn&#x27;t quite do that, but it does put _most_ of its functionality into functions, and AFAICT there is no particular place in the script where a connection loss could lead to anything bad happening. Admittedly this appears to be a lucky accident rather than following best practice.