Cleanup methods for providers (implemented for GDAL and OGR)
Fix #8932