anchor.diff:          Else -> couch_db:close(Else)
       end,
   
  +    case NewGroup#group.db of
  +        nil -> ok;
  +        _ -> couch_db:close(NewGroup#group.db)
  +    end,
  +
       self() ! delayed_commit,
       {noreply, State#group_state{
  -        group=NewGroup,
  +        group=NewGroup#group{db = nil},
           ref_counter=NewRefCounter,
           compactor_pid=nil,
           updater_pid=NewUpdaterPid
  
positive.code:         ViewStates2, Views),
      Group#group{db=Db, fd=Fd, current_seq=Seq, purge_seq=PurgeSeq,
          id_btree=IdBtree, views=Views2}.
  
  reopen_db(DbName, nil) ->
      couch_db:open_int(DbName, []);
  reopen_db(_DbName, Db) ->
      couch_db:reopen(Db).
  
negative.code: handle_cast({start_compact, CompactFun}, #group_state{compactor_pid=nil}
          = State) ->
      #group_state{
          group = #group{name = GroupId, sig = GroupSig} = Group,
          init_args = {RootDir, DbName, _}
      } = State,
      ?LOG_INFO("View index compaction starting for ~s ~s", [DbName, GroupId]),
      {ok, Db} = couch_db:open_int(DbName, []),
      {ok, Fd} = open_index_file(compact, RootDir, DbName, GroupSig),
      NewGroup = reset_file(Db, Fd, DbName, Group),
      Pid = spawn_link(fun() -> CompactFun(Group, NewGroup) end),
  