lib/tree: getHeads waits with next item
lib/tree: getHeads waits with next item

Simpler and more robust getHeads implementation because of using
a Transform stream and no more manual item counting.

Netsend/PerspectiveDB,Netsend/persdb,Netsend/PerspectiveDB,Netsend/persdb,Netsend/PerspectiveDB,Netsend/persdb