gui: Save positions of windows only when they are closed.