Fixing DistCopy - flush stream before moving tmp file

@raronson @charleso 
Can we not use `ResultT.using` to handle the cleanup rather than calling `unsafePerformIO` multiple times?