Update to close connection on exit in test script