I think you need to create a project file and then it stores things there.
For a long time I would get paranoid about accepting Mac updates which would require a reboot because then I'd lose my undo history and then I discovered that this is all I would need to do.
While I meant closing the whole application at once (which restores all windows/projects and unsaved changes when you restart ST), you're right that projects keep track of unsaved state on a per-project basis, too. So you can open and close project windows individually, but also do the same for Sublime Text as a whole.