Close test connections earlier

This was causing a problem with tests
hanging at their conclusion.
Handle unparseable result data