You could use hist -g in the console to get your history back.
And you could do this:
Tools > Preferences > General > Advanced Settings
check Prompt when exiting
When I use Spyder, I have fairly frequently accidentally closed the wrong consoles. Usually by a cmd+W. Most applications ask if I want to save before close/confirm I definitely want to close. Spyder just closes, so I may lose training that's been occurring for an hour, say, by a single click or keyboard typo, and I cannot find a way to get it to ask before it does close a console.
Anyone know how to fix this?
Spyder - stop consoles accidentally closing