Only restore window when it is minimized

Restoring a maximized windows on Windows unmaximizes it.

Closes #3381