eventscript: fix bug when script is aborted