remove the menu and fix some bugs about memory leaks
Also modified the closeAction and exitAction.