v.20.1Bug Fix

Fix memory leak during exception handling in aggregation with -State functions

Fix memory leak when exception is thrown in the middle of aggregation with -State functions. This fixes #8995. #11496 (alexey-milovidov).