Oh no!
Yes, the file seems to be broken.
And I finally found the reason. THANK YOU!
The file is created elsewhere, then this function is called.
File creation is inside try-Finally-End, and also function is called from inside.
But the file is closed later at the Finally part.
So it is left open while function is called and it is not flushed causing missing chars (BTW: one file block is 512 bytes, the second block was not yet flushed ! )
Program is run and I see from debug that last line was broken.
Then I look the file and it is complete!
That is because it is closed at the Finally part that happens before I peek the file!
Very hard to find out!
I moved the file close just before calling then function and now output is complete. Every time.
Case is closed.
MANY THANKS!