tests: Call res_close in res_query and res_search tests