MB-9999 Do not free btree roots if they haven't changed

When btree cleanup or update is performed, if there is no modification
required in the btree (Eg. if same kv pairs are added again) the root
remains the same. In such cases, it results in double freeing and
may cause segfault.

Added a check to prevent freeing if root node is still the same after
cleanup or update.

Change-Id: If8e5b1665f607559d939d402d88067677a1d965a
Reviewed-on: http://review.couchbase.org/32853
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: buildbot <build@couchbase.com>