Make all fs write stream usage atomic

Fix #5920

Review plz @othiym23