Fix crash on save when icc_profile is None

Includes #496 from @brutasse

*  Tests are cleaned up from @brutasse's version.