Fixing DistCopy - flush stream before moving tmp file

@raronson @charleso 
@etorreborre Do you know if there was a reason for the .getWrappedStream? It looks safe to remove to me, just double checking.