Add write lock usage in stream

Fixes issue when writing multiple data frames simultaneously