Acts as a valve to stop requests on closed objects. It is a two phase valve. When close() is invoked on the facade object, the logic is as follows:
Invokes closing() on the api and any sub objects (e.g. the closing a session closes the browsers, consumers and producers). This prevents any new requests on these objects.
Waits for inflight requests to finish (on sub objects first).
Invokes closed() on the api which tidies up the resources.
NOTE: Only one thread is allowed to actually perform the close.