close search-result window correctly