Navigation issue when closing the gallery

Hi,
I have an issue when closing a gallery. Just after I have closed it, if I click on the browser back button, it reloads the current page, and if I click it again it reopens the gallery at the last viewed picture.
I have the following code for the page where the gallery is displayed and the GalleryItems are set (from a json that I recover from a 3rd party service):

import wixLocation from 'wix-location';
import {getPropertyBundle} from 'backend/propertyBundleService';

var propertyBundle = [];

$w.onReady(function () {
	
	let query = wixLocation.query;

	getPropertyBundle(query.propertyId)
		.then(json => {			
			
			propertyBundle = json;
			var pictureArrayList = propertyBundle.pictureArrayList;
			
			let items = $w("#propertyGallery").items;
			
			//setting GalleryItems into Gallery
			for (var i = 0; i < pictureArrayList.length; i++) {
				items.push( {
				  "src": pictureArrayList[i].pictureURL, width:1400, height:700,
				});
			}

			$w("#propertyGallery").items = items;
	
		});
		
	
});

Is there a way to fix this or should I implement a back button in the page usinf wix-storage?
I know how to implement the button using wix-storage but would be nicer have this working directly with the browser back button, as the customer is asking for that.