When using an instance of Sql constructed with a DataSource, I experience a Connection Closed SQLException inside of withTransaction. In the finally clause, calling setAutoCommit(savedAutoCommit) causes another SQLException to be thrown. This means that cacheConnection remains true, and useConnection is still set. The connection is never closed and returned to the DataSource's pool which would allow it to be closed and a new one opened. The next time withTransaction is called, it uses the already set useConnection, which will throw the Connection Closed SQLException again.
This should be fixable by simply wrapping the setAutoCommit in a try/catch just as the other parts of closeResources wrap their actions.