image viewer closes automatically at the end