refactor(client): client cleanup; return non-zero on errors

This PR adds a couple commits to clean up some leftovers from the client, as well as fixing up #767. See the commit bodies to get a gist of what each commit fixes.