Fix an exception thrown when closing the search form while it is still searching