diff --git a/QuickFIXn/Store/FileStore.cs b/QuickFIXn/Store/FileStore.cs index 770f11659..3820bf092 100755 --- a/QuickFIXn/Store/FileStore.cs +++ b/QuickFIXn/Store/FileStore.cs @@ -269,10 +269,11 @@ public void IncrNextTargetMsgSeqNum() private void SetSeqNum() { _seqNumsFile.Seek(0, System.IO.SeekOrigin.Begin); - System.IO.StreamWriter writer = new System.IO.StreamWriter(_seqNumsFile); + System.IO.StreamWriter writer = new System.IO.StreamWriter(_seqNumsFile, leaveOpen: true); writer.Write(NextSenderMsgSeqNum.ToString("D20") + " : " + NextTargetMsgSeqNum.ToString("D20") + " "); writer.Flush(); + writer.Dispose(); } public DateTime? CreationTime => _cache.CreationTime;