ENG-4625 fix leaks and logic errors in matview min/max and matview nullable aggs