What happens is that when you close the first window, Sublime thinks "oh, look, now there's only one window open". Then you close the second window, and Sublime thinks "whoops, I'm closing! better remember my only open window". I agree that this behaviour could be made more intuitive.
As a workaround, go to File>Hot Exit, which closes all windows and remembers them. I think in ST3 it's now just File>Quit.