How to make a close button for menu

I recently made a pop-up menu for my game which pops up after pushing a button. The problem is now that the buttons are not very interactive and every time I take the backbutton function outside keyboard event the game freezes. Then I error that states that backbutton is undefined. Here is the code:

this.input.keyboard.once("keydown_D", event => {
	var StoreWindow = this.add.image(0, 0, 'StoreWindow').setOrigin(0);
    var backbutton = this.add.image(32, 34, 'backbutton', 0).setOrigin(0).setInteractive();
    var testButton = this.add.image(64, 110, 'testButton', 0).setOrigin(0).setInteractive();

    var storeContainer = this.add.container(32, 70, [ StoreWindow, backbutton, testButton]);

    storeContainer.setInteractive(new Phaser.Geom.Rectangle(0, 0, StoreWindow.width, StoreWindow.height), Phaser.Geom.Rectangle.Contains);

    this.input.setDraggable(storeContainer);

    storeContainer.on('drag', function (pointer, dragX, dragY) {

        this.x = dragX;
        this.y = dragY;

    backbutton.on('pointerup', function () {

       this.storeContainer.destroy();

    }, this);

      
 })
.setScrollFactor(0)
.setDepth(30);