Fixed a bug that causes hidden window being made as keyWindow.