On a gateway remote timeout, there's a race between the reader and writer thread to close the connection. Change the `released` boolean to an `AtomicBoolean` to avoid the unexpected exception when the other thread attempts to return a non-existent connection to the pool.