Debugger now stops correctly

Fixed a bug where the debugger wouldn't stop after the script was
finished running.