Implemented saving/restoring window state and geometry.