Fix SharedWriter to track all streams/files so that derivation runs in multi stream mode.
Without this fix, the first stream metadata will switch off writing for the other streams.
Without this fix, the first stream metadata will switch off writing for the other streams.