Resolved - Why is old scene not destroyed?

Resolved the old scene destroy using the following script

var BtnStates = pc.createScript(‘btnStates’);

BtnStates.attributes.add(‘hoverAsset’, {
type:‘asset’,
assetType:‘texture’
});

BtnStates.attributes.add(‘activeAsset’, {
type:‘asset’,
assetType:‘texture’
});

// initialize code called once per entity
BtnStates.prototype.initialize = function() {
// Get the original button texture
this.originalTexture = this.entity.element.textureAsset;

// Whether the element is currently hovered or not
this.hovered = false;
            
// mouse events
this.entity.element.on('mouseenter', this.onEnter, this);
this.entity.element.on('mousedown', this.onPress, this);
this.entity.element.on('mouseup', this.onRelease, this);
this.entity.element.on('mouseleave', this.onLeave, this);    

// touch events
this.entity.element.on('touchstart', this.onPress, this);
this.entity.element.on('touchend', this.onRelease, this);

};

// When the cursor enters the element assign the hovered texture
BtnStates.prototype.onEnter = function (event) {
this.hovered = true;
event.element.textureAsset = this.hoverAsset;

// set our cursor to a pointer
document.body.style.cursor = 'pointer';

};

// When the cursor leaves the element assign the original texture
BtnStates.prototype.onLeave = function (event) {
this.hovered = false;
event.element.textureAsset = this.originalTexture;

// go back to default cursor
document.body.style.cursor = 'default';

};

// When we press the element assign the active texture
BtnStates.prototype.onPress = function (event) {
event.element.textureAsset = this.activeAsset;

this.app.loadSceneHierarchy('673061');
 
var oldHierarchy = this.app.root.findByName('Root');   

// e.g. If the URL when Scene 1 is loaded is: https://playcanvas.com/editor/scene/475211
// The ID is the number on the end (475211)
    // Once the new scene has been loaded, destroy the old one 
    oldHierarchy.destroy();
};

// When we release the element assign the original texture if
// we are not hovering or the hover texture if we are still hovering
BtnStates.prototype.onRelease = function (event) {
event.element.textureAsset = this.hovered ? this.hoverAsset : this.originalTexture;
};