Clean up of QueryContext