CB-6378 Use connection.disconnect() instead of stream.close() for thread-safety