anchor.diff:      end.
   
   close_trees(State=#state{trees=Trees}) ->
  -    Trees2 = [{IdxN, hashtree:close(Tree)} || {IdxN, Tree} <- Trees],
  -    State#state{trees=Trees2}.
  +    Trees2 = [begin
  +                  NewTree = try
  +                                hashtree:flush_buffer(Tree)
  +                            catch _:_ ->
  +                                    Tree
  +                            end,
  +                  {IdxN, NewTree}
  +              end || {IdxN, Tree} <- Trees],
  +    Trees3 = [{IdxN, hashtree:close(Tree)} || {IdxN, Tree} <- Trees2],
  +    State#state{trees=Trees3}.
   
   %% @private
   %% @doc Unless skipping the background manager, try to acquire the per-vnode lock.
  
positive.code:         false ->
              ok
      end.
  
      
  
negative.code: handle_info(_Info, State) ->
      {noreply, State}.
  
  terminate(_Reason, State) ->
      close_trees(State),
      ok.
  
  code_change(_OldVsn, State, _Extra) ->
  