It looks like there's a closeQuietly(connection) missing here. Since there is a call to getConnection, there should also be a close().
It was already missing before your changes, I guess.