Fix race after output file creation that can lead to EEXIST during clean up.

When node returns a file descriptor for a newly-opened file, it doesn't
necessarily mean that the file is present in its parent directory yet.

And note that `fsync(2)` states: "Calling fsync() does not necessarily
ensure that the entry in the directory containing the file has also
reached disk. For that an explicit fsync() on a file descriptor for
the directory is also needed."

Add appropriate calls to `fs.fsync`, both on the file and its
containing directory, to ensure that `rimraf` doesn't throw an
`EEXIST` by trying to remove the directory before the output
file is "present" in it.
Merge pull request #6 from cscott/race-be-gone

Fix race after output file creation that can lead to EEXIST during cleanup