There are a couple ways to solve this.
One way, as in another proposed answer, is to offer the user the option to cancel the query in progress.
But this is quite simplistic as there are multiple kinds of cases to consider, which might cause the user to be annoyed with a blocking UI, for example:
The user has made a mistake in their first query and needs to correct it (this is what you're concerned with initially)
The user realizes that the first query, while correct, may not return all the information that they'd like. They'd like to explore other query options. They don't know yet if they'll be able to issue a better query so they want the ability to draft a new query without cancelling the first or waiting for the first to finish
The user realizes that the first query, while correct, can be enhanced. They write a second query which tries to enhance it but unfortunately turns out to have a bad mistake in it, and they only realize it when the results of the second query come in. It would have been better if the user has had the option not to cancel the first query which might have produced useful results.
The user wants to issue multiple queries because a single query won't answer all their questions. They want to queue them up rather than have to wait for each one to finish before executing the next one.
A way to solve all these issues is to represent, instead of the results of a single query below your search form, results for a list of multiple queries.
Then, when a new query is executed, you add the new query in progress to the list at the bottom, with a progress indicator and a cancel button. The query form is not disabled, but if you start a second query, it adds the query to the list, above the first one that is still ongoing as well. The results area for your queries essentially becomes a master/detail view where you're able to see the list of previously executed and still ongoing queries, to inspect their results.
Finally a third alternative is to present a form of tabbed UI, where each tab is a different query form. Then within each tab there's a blocking modal indicating that the query is in progress, and a cancel button, but without preventing the user from opening a new tab to create a new request. Unfortunately this approach doesn't support very well the use case of applying a simple tweak to a complex query, since typically you'd want to start each new tab with a blank search form.