use tempfiles instead of locking

This avoids the issue of corrupted files being written to disk when some
renderer fails.
Merge pull request #21 from brainlock/tempfiles-instead-of-locking

use tempfiles instead of locking