Added setting to control if script will close window on finish