test: Fix a potential use-after-free when using stopAsync

Since we're now using an async stop function, we might be freeing the
buffer while it's still being used.
Instead, release it automatically after the instance itself has been
released since we're guaranteed to have joined all threads at this point
2 jobs for !20 with examples_fix_potential_user_after_free in 1 minute and 21 seconds (queued for 2 seconds)
latest merge request