Fix invalid thumbs flickering when closing image