loading images and shuting down correctly