First destroy the window, then restore resolution.

This may solve some possible issues with WM fullscreen.