The problem ended up having to do with the allocation address of the memory for the data being read into memory. When the allocation address exceeded the 32 bit boundary the program would crash.
This also led to other people testing the code and it working for them. Presumably they were only using 4GB of RAM in their computer (or were just getting really lucky).
I also would occasionally get the code to work. I thought this might have something to do with processes that were running, without realizing that it had to do with where there were gaps in the memory for allocation.