JVMCBC-43: Fix ConcurrentModificationException on disconnect with more buckets.

Motivation
----------
When more buckets are closed in parallel, a ConcurrentModificationException was raised
because the same map was still iterated while it was being updated.

Modifications
-------------
This changes first creates a distinct set of all the buckets to close and then iterates
over it, mitigating the possibility of iteration while modification.

Result
------
No more ConcurrentModificationException on shutdown with more than one bucket.

Change-Id: I270edaa9452a9212f5b0dd1038f9580d2739a250
Reviewed-on: http://review.couchbase.org/42122
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Reviewed-by: Simon Baslé <simon@couchbase.com>
Reviewed-by: Sergey Avseyev <sergey.avseyev@gmail.com>