Further autoclosing of DB connections

Attempting to fix leakage of connections in the tests.