Handle server exceptions

Trying to clean up more stray exceptions that aren't handled internally.

I also noticed that we are re-using the client across tests, which could mean there are still requests outstanding when we've moved on to a newer test, so I wanted to rule that out by closing the connection after each test.