Better error message when client is closed. Tests.