Fix bug when close, the window have no response.