Changes to remove leaks from btree code and tests.