Fixed memory leak due to not cleaning up per thread buffers. All valgrind passes.