finish query operation by connection