changed way to wait for file copy to finish to use lsof