I'm creating a QgsRasterLayer from temporary file, as result from some processing algorithm. After that, I no longer can delete file, as expected. But, because It is only a temp file, I need delete It after all my processing is done. I tried, without success:
layer = QgsRasterLayer("myTempFile.tif") #Do some work... del layer
myTempFile.tif still can't be deleted, but only after closing QGIS.