MV Yanfly Row Formation modifications (3 front / 3 back)

Modifying this script to suit my needs but I ran into an issue, I originally took information from this thread.

This was a good start, but doesn't really work for what I need because once the 3 party members are set the rows are locked and can't be adjusted again, so I instead play the buzzer at 4 instead of 3. Works great, except, now you can leave the menu with 2/4 or 4/2, but I want to lock it to 3/3. So on line 2465 I added:
Code:
Scene_Row.prototype.closeWindow = function () {
    if (($gameParty.rowSize(1) != 4) && ($gameParty.rowSize(2) != 4)) {
        this.popScene();
    }
    else {
        SoundManager.playBuzzer();
    }
};

I also changed the handler from popping the scene to calling this function on line 2461:
Code:
this._rowFormationWindow.setHandler('cancel', this.closeWindow.bind(this));

The scene pops if 3/3 is set, but freezes the game if 2/4 or 4/2 is set. There's no update function in this scene, so I added:
Code:
Scene_Row.prototype.update = function () {
    Scene_MenuBase.prototype.update.call(this);
};

Still freezes. Okay... Maybe the window is the issue because it has no update function? So I added:
Code:
Window_RowFormation.prototype.update = function () {
    Window_Selectable.prototype.update.call(this);
}

Still freezes. Not sure where to go from here? In my custom menus I've been making, calling the original update function has solved this problem. Any ideas?
Add as a new plugin and place it below Row Formation. Change the const to whatever limit you want per row (3 by default)
JavaScript:
(function() {

const MAX_ACTORS_PER_ROW = 3;

var _Scene_Row_create = Scene_Row.prototype.create;
Scene_Row.prototype.create = function() {
    _Scene_Row_create.call(this);
    this._rowFormationWindow.setHandler('cancel', this.onRowFormationCancel.bind(this));
};

Scene_Row.prototype.onRowFormationCancel = function() {
    if (this.areActorRowsValid()) {
        this.popScene();
    } else {
        SoundManager.playBuzzer();
        this._rowFormationWindow.activate();
    }
};

Scene_Row.prototype.areActorRowsValid = function() {
    for (let i = 1; i <= Yanfly.Param.RowMaximum; i++) {
        if ($gameParty.rowSize(i) > MAX_ACTORS_PER_ROW) {
            return false;
        }
    }
    return true;
};

})();

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-row-formation-modifications-3-front-3-back.181178/