Fixed all connections leaks and tested it on H2 and PostgreSQL. For PostgreSQL, it worked even with just 10 max_connections.