I have no idea what is happening to make your program act that way but if you set the table to table buffering rather than row buffering your problem may go away.
A problem is a problem only as long as it has a possible solution. Lacking that, it becomes a FACT!