btree: Fix some memory-leaks caught by Valgrind

TODO: Fix the memory leak when using ts_btree_remove