This fixes the two failing btree_counter tests. The blocknr in each
node is filled in when written out. These days (thanks to Ming) the
counter also checks the btree, *but* if there are any problems
encoutered it just skips counting that node.
We had a cycle from transaction_manager <-> space_map, and also from
the ref_counters back up to the tm.
This prevented objects being destroyed when various programs exited.
From now on we'll try and only use a shared ptr if ownership is
implied. Otherwise a reference will be used (eg, for up pointers).