Fix a crash when quitting while searching