Added addWindowListener for window closing event. So the program can be
terminiated everytime when clicked the cross.