Improved shutdown of scripts written by editor