Dwipreproc corrupting previous files

If it runs correctly from a different location, I would suspect a faulty SSD, or some error in the filesystem at this point. Can you specify what filesystem your SSD is formatted with? And can you confirm it has sufficient remaining capacity to store all of the intermediate and output files?

Bear in mind that the script will generate a temporary folder to store all the intermediate outputs, and that by default, this folder will be created in the current working directory (more details in this wiki post). It may be that specifying a different location for the scratch folder (via the -scratch option) that isn’t on the SSD might give better results.