Fixes a crash when saving exr files
Saving an 8-bit integer image to .exr when also flattening
layers turned on caused a crash. This was due to how the
colorspace conversion worked.
A copy layer of the flattened image was created and the image
was color converted after that. But the new layer was never
converted.
This fix will convert the colorspace before flattening.