Add a check to make debugging easier when the client has been closed previously (e.g., an misplaced defer() closed it).