MB-10161 Don't crash when closing a NULL ptr

Change-Id: If0ed787a491ed247753dd8340c3043f2bb88e5f8
Reviewed-on: http://review.couchbase.org/33475
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>