image viewer: handle condition when case is being closed and image had been selected earlier