move lock (fileStreaWriteLock) location to prevent io error