MB-12643:bp:MB-11631 Ensure terminate is called if ensure_bucket succeeds.

This is backported as part of backporting MB-12156.

Change-Id: Ib03c6034c8d63e7c6a1d027f34992c9c63608183
Orig-Reviewed-on: http://review.couchbase.org/39197
Reviewed-on: http://review.couchbase.org/43228
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>