Prevent memory leak that comes when changing the image while transitioning
between two others.