Cherry-pick !5d1b2cdc from master: Add flag to OutputStream to write metadata and close after next Event. ATEAM-832
Add flag to OutputStream to write metadata and close after next Event. ATEAM-832
See merge request !53619 (merged)
(cherry picked from commit b4fc1ea8)
5d1b2cdc Add flag to OutputStream to write metadata and close after next Event