use `try ... finally` to close client on exception