ERROR : unable to open $file in write mode