It sounds like you’re bumping into one of the ‘ulimit’ parameters. I had the same problem when I was building a rather large file for a resend. I wound up breaking it into several files.
You can run ‘ulimit -a’ to get a list of your user resource limits. Here are my settings:
$ ulimit -a
time(seconds) unlimited
file(blocks) 2097151
data(kbytes) 131072
stack(kbytes) 98304
memory(kbytes) 98304
coredump(blocks) 2097151
nofiles(descriptors) 2000
Hope this helps.
Steve