removed the final writeRaster from the step3.