Is it possible to close a script with a keypress?
I’m not quite sure if my solution will help you or not.
I have a whole bunch of different AppleScripts attached to folders by use of Folder Actions and I also run AppleScripts directly from the Script Menu in the menu bar.
Occasionally one of my AppleScripts decides to misbehave and freezes or gets stuck and trying to quit the running AppleScript from the spinning gear in the menu bar does not work either.
My solution in these circumstances is to run this following AppleScript code.
tell application &quot;System Events&quot;
    set pidList to unix id of application processes whose name is &quot;osascript&quot;
end tell

set text item delimiters to space
do shell script ({&quot;kill -9&quot;, pidList} as text)
set text item delimiters to &quot;&quot;

I saved the AppleScript code as a .scpt file and run it using Voice Commands, but you can just as easily use the code in a new Automator Quick Action then assign it a keyboard shortcut in System Preferences.

NOTE: One of the drawbacks of this solution is that if you are running several scripts at the same time, this will force quit each one. As far as I know, there is no way of knowing which osascript belongs to which running AppleScript. (Not knowing which is which forces me to force quit each one.)
Again, I don’t know if any of this will help you or not.  If nothing else maybe it will help spark some ideas for you.