more error handling on copyStream/copyFile()