Merge "Make test encoder test driver less likely to leak on failure." into nextgenv2