Fix IO_Write to handle long input that is not in IsStringRep

The C function IO_write expects the string input to be in IsStringRep,
but a bug in the GAP function IO_Write passed parts of long Strings
directly to IO_write, which lead to Strings not being writable when
the write buffer overflowed.
This patch makes IO_Write copy all input into the write buffer before
calling IO_write on the write buffer.