Don't cleanup the dead nodes when pruning the tree
The dead nodes might get reactivated during the db iterator walks the version of the tree, so we can't cleanup the dead nodes while the db version is open. Restore the previous behaviour that cleaned up the dead nodes when we are closing the version.
Closes #3646 (closed)