Close share menu after Scriptable Script ran

I have a script that I’m running via the Share Sheet → Run Sciprt menu.

Once that script has finished running I want the share menu to close / disappear. At the minute it goes back to the Scriptable screen and I then have to click done.

Is there a way for me to mark it as done so that the Share Menu closes.

Oh turns out if I run Script.complete() that it does it!

It even says so in the documentation. Whoops!