Fix thumbnail generation

Since changes to the TKP accessors mean we can no longer directly use an HDU
from MongoDB, we rather write a temporary fits file and generate the thumbnail
based on that.

Addresses #4316.