Added a loop for r.series, as without it r.series exceeds the hard and soft limit of the number of rasters that can be opened concurrently (1024).