Turn off the setting of QGIS to produce XML when closing Raster layer
Are the xml files *.aux.xml?
If so, it's not QGIS creating them, it's the GDAL library which uses them to store metadata, including statistics. You can disable completely by setting the environment variable GDAL_PAM_ENABLED=NO though I don't advise this if you'll be displaying the rasters again as there won't be any statistics cached.
Instead, you can tell GDAL to store the aux.xml files in another directory by setting the environment variable GDAL_PAM_PROXY_DIR=some_folder