I have a hair shape separated into multiple parts. Here it is:

And the hair color should be a gradient, so I tried to clip a simple square with a gradient color on it onto the hair. And it preview it gives me the desired result:

But when I render, it gives me this horrible result:

It seems like it's not ignoring the inner strokes. How would I go about fixing this?
