window: save state once when closing window

Saving it at each configure event causes too much disk I/O.