Fixed an issue where the callback function from an alert could get stuck if the callback reloads the page or triggers a Javascript alert, etc.