Deallocate the space after the query finishes