If you switch scene, it means you're removing the current scene. If you don't save the state of that scene, you'll be back to your initial state when you switch back. You could implement a temporary scene save file when switching to your menu scene, or you could take the followong simpler approach:
- when the use press ESC, pause the game (see the official docs for that)
- show the menu scene over your current scene, instead of switching
- when the user press no, remove the menu scene and unpause the game
This way, you don't have to save/load everytime you want to show a menu.