Fixed the closing operation. First draft of GUI.