Fix the bug of recovering window

This commit fix the bug that the user could not recover the window when the they click the close button of the window and press the icon on the dock after that.