Close connection in test cases

This should allow phpunit tests to run cleanly without running out of connections.