Added btree freeing function.