Update closed flag

Update closed flag even if the stream is not initialized.
This to prevent the consumer thread from running indefinitely, for example when
it’s sleeping and waiting to reconnect after an initial HTTP error.