anchor.diff:      State3#state{built=false, expired=false}.
   
   destroy_trees(State) ->
  -    State2 = close_trees(State),
  +    State2 = close_trees(State, true),
       {_,Tree0} = hd(State#state.trees), % deliberately using state with live db ref
       _ = hashtree:destroy(Tree0),
       State2.
  
positive.code:                             end,
                    {IdxN, NewTree}
                end || {IdxN, Tree} <- Trees],
      _ = [hashtree:close(Tree) || {_IdxN, Tree} <- Trees2],
      State#state{trees=undefined}.
  
  -spec get_all_locks(build | rehash | upgrade, index(), pid()) -> boolean().
  get_all_locks(Type, Index, Pid) ->
  
negative.code: has_index_tree(Trees) ->
      orddict:is_key(?INDEX_2I_N, Trees).
  
  close_trees(State) ->
      close_trees(State, false).
  
  close_trees(State=#state{trees=undefined}, _WillDestroy) ->
      State;
  close_trees(State=#state{trees=Trees}, false) ->
      Trees2 = [begin
                    NewTree = try
                                  case hashtree:next_rebuild(Tree) of
  