Fix quality setting when exporting thumbnails.

It was called after write() and wasn't actually used before.