Apparently moving the window doesn't trigger the "resize" event, so
window state is not saved. Now also listening to "move" event.