Since a few nightly builds, your query tabs are now stored automatically. This means the code in them is back again when you restart HeidiSQL, without the need to select one or more files for each tab.
This was one of the most wanted features from many users, and now I heard you - finally :) Read about the progress of this conveniance feature on GitHub.
By default, the old „ask to save contents“ dialog is still activated, but now tells you about the uselessness of it, when you exit HeidiSQL:
You can disable or enable these settings in the new „Files“ tab on the Preferences dialog: