Create window closing script with halt command.

I was selecting Halt command from the button options, but felt it is
better practice to put all commands in scripts, not buttons for better
transparency.