Write export image to a temp file then rename.