finish flattenbinarytree