saving images before restarting