Hey There,
If it doesn't show you straight up, can you post the output near the end of this execution:
strace -f /full/path/to/your/program
That should show you what system calls happen, files get opened/closed, etc right before the crash.
Hope that helps
, Mike