Modified Client.close to handle streams which have already ended.