tree: break out on write error If write_tree() returs an error, we used to set the error message and continued looping. Exit the loop so we return the error.