INDY Writing to a file disconnect TCP client

Hi,

Did someone ever experience connection problem with a TCP connection
while trying to write to a file ?

If I uncomment the next block, the WriteLn still works, but the client
will be soon disconnected.

   //FILE* file = fopen("Seat.txt","w");
   //if(file!=NULL) {
   //   WriteLine(file,Seat);
   //   fclose(file);
   //   }
   TCPClient->WriteLn("foo");

Commented, all works fine.
Quite strange.

Mickael.