Thank you for your post.
I am able to replicate the problem, and it occurs in any directory; not just the temporary directory. Like you, any subsequent attempt works correctly.
I have forwarded your post, along with my findings, to our Development and Testing departments for further review. I will keep you updated as information becomes available to me.
There is some further troubleshooting I would like you to try for this issue. First, I would like you to run repair disk permissions on your machine. Go to MacintoshHD/Applications/Utilities and launch the Disk Utility. In the Disk Utility, select the MacintoshHD and click repair disk permissions. After the repair finishes, try running your export script and see if the error or crashing still occurs.
I would also like you to test this issue in a new database file. In FileMaker, create a new empty database and add a container field on each record. Add in some media and setup the same export script in this new file. Test and see if the same error comes up within a new file. Let me know what results happen following these steps.