Since windowing data may have been freed, validate the members before restoring them when the context-manager exits.