Fixing script text editor window that closes suddenly