This is a fix for #18135, which was closed before the patches were applied. I have tested and the DB connections are properly closed.
[1.3.x] Fixed #18135 -- Sleeping Database Connections on Startup with…
… MySQL - Made sure server version checking does not leave open connection behind. - Backport of cfc2561
pulled in manually