fix a bug that close one of mutiply windows will crash