@Override
    public void close() {

        try {
            List<Cleanable> cleanablesCopy;

            synchronized (cleanables) {
                if (cleanables.isEmpty()) {
                    return; // only notify that the context was cleaned.
                }

                cleanablesCopy = new ArrayList<>(cleanables);
                cleanables.clear();
            }

            Collections.reverse(cleanablesCopy);
            cleanablesCopy.forEach(this::notifyCleanableRemoved);

            ThrowableSuppressor throwableSuppressor = new ThrowableSuppressor();

            for (Cleanable cleanable : cleanablesCopy) {
                throwableSuppressor.suppressAppend(cleanable::close);
            }

            throwableSuppressor.throwIfNecessary(t -> new CloseException("Exception thrown while cleaning StatementContext", t));
        } finally {
            notifyContextCleaned();
        }
    }
Registers a {@code Cleanable} to be invoked when the statement context is closed. Cleanables can be registered
on a statement context, which will be cleaned up when
the statement finishes or (in the case of a ResultIterator), the object representing the results is closed.
<p>
Resources cleaned up by Jdbi include {@link ResultSet}, {@link Statement}, {@link Handle},
{@link java.sql.Array}, and {@link StatementBuilder}.

@param cleanable the Cleanable to clean on close
core/src/main/java/org/jdbi/v3/core/statement/StatementContext.java