Improvements to window restoration done while fixing #86329
Merge pull request #213 from luisromangz/8.5-SNAPSHOT-86329

Improvements to window restoration done while fixing #86329