MZ Text overlapping issues with windows

I don't know how to update a value in window without it constantly drawing. I have a status effect system that kills the target after 10 turns(there's a way to remove the effect) and a timer appears above their heads letting the player know how many turns they have left.

If the current countdown is 5, I want it to say 5 and not 1098765 overlapped. I've tried clearing the rectangle, even destroying it but that doesn't prevent redrawing. The countdown to be drawn:

Spoiler
JavaScript:
CurseCountDownWindow.prototype.drawCountDown = function(actorId) {
    const actors = $gameParty.members()
    const actorIndex = actors.findIndex(members => members.actorId() === actorId)
    this.drawText(actors[actorIndex]._curseTurnCount, 0, 0, 48);
};

the countdown is iterated at the end of each turn process:
Spoiler
JavaScript:
BattleManager.processTurn = function() {

    const subject = this._subject;
    const action = subject.currentAction();
   
    if (subject.hasState(Curse.curseStatus) === true) {
       
        // Either was removed, yet to be applied or the application is in progress.
        if (subject._curseTurnCount === -1) {
            subject._hasCurse = true;
            subject._curseTurnCount = 10;
           
            // passed to the window's drawCountDown method for testing.
            Curse.cursedActorId = subject.actorId();
        };
       
        if (subject._hasCurse === true && subject._curseTurnCount > 0) {
            subject._curseTurnCount -= 1;

            // the count down in the window should be changed here to reflect turns
            // left til death.

            if (subject._curseTurnCount === 0) {
                Curse.cursedActorId = 0;
                subject._curseTurnCount = -1;
                subject._hasCurse = false;
                subject.die();
            };
        };
    };

    if (action) {
        action.prepare();
        if (action.isValid()) {
            this.startAction();
        }
        subject.removeCurrentAction();
    } else {
        this.endAction();
        this._subject = null;
    }
};
You should clear [that area of] the bitmap before drawing. Here are a couple of options~
  1. Clear the entire bitmap:
    JavaScript:
    this.contents.clear();
    This is typically used in refresh methods: clear then redraw everything.

  2. Clear a rectangular area of the bitmap:
    JavaScript:
    this.contents.clearRect(x, y, width, height);
Yes thank you. I tried the clearRect one earlier which didn't work as expected for some underlying reason, but clear() did the trick.

Original thread: https://forums.rpgmakerweb.com/threads/text-overlapping-issues-with-windows.140588/