I had the problem when exporting a big 1080 movie that iMovie would quit with an “error -49” when it was almost finished. A smaller 720 pixel movie would be OK.
In the end I found the solution on an apple discussion page. Apparently the error means that the file is already open in write mode. And the bigger the exported movie, the longer it takes to run (of course). And, that’s apparently the problem, the longer that time machine can try and stick it in a local snapshot directory on your laptop. See a full explanation of that local snapshot thing.
The solution: run sudo tmutil disablelocal in your terminal to switch off the local snapshots.
Thanks to elikeness for figuring it out!