This can be done using the menu command manager.
Here is the code that will create a "Close" command for your menu
var TH_SceneMenu_closeMenu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
Scene_Menu.prototype.createCommandWindow = function() {
TH_SceneMenu_closeMenu_createCommandWindow.call(this);
this._commandWindow.setHandler('closeMenu', this.commandCloseMenu.bind(this));
};
Game_Unit.prototype.addMenuCommand_closeMenu = function() {
var command = new Data_MenuCommand("closeMenu", "Close");
this.addMenuCommand(command);
};
Window_MenuCommand.prototype.addCommand_closeMenu = function(cmd) {
this.addCommand(cmd.name, cmd.symbol, cmd.isEnabled(), cmd.ext);
};
Scene_Menu.prototype.commandCloseMenu = function() {
SceneManager.pop();
};
You can either create a new plugin file, or add this to the end of menu command manager.
Then, to add the command to the party, you would use the script call
$gameParty.addMenuCommand_closeMenu()
Which will add the command to the end of the party menu.
This is how it will look
If you want to change the name of the command, look at the code and look for "Close".
You can also rename menu commands using script calls provided by the menu command manager.