You cannot close queries in the Data Viewer. To close a query, you must navigate to the CRF.
For more information, see Navigating from the Data Viewer to a CRF and Closing queries.