PDF/A compliance issues: metadata, color space

Did you try running validation before making the changes? Were the errors 721 and 2331 already present, or introduced when you ran this code?

If they were introduced, can you post/send the input and output files, either here, or to support at pdftron.