I was writing to a Windows file share and saw behavior where the send port would not complete writing out the flat file or the flat file would contain more records than the inbound document. After opening up a Microsoft ticket, the following KB article solved our problem.
http://support.microsoft.com/kb/810886