It works here on Closed plines. If you manually close them, i.e. snap the last point to the start point, then it won't work.
And please, don't just say "it's not working".....post exatly what it does, or does not, do along with any error messages.
To test if this works just draw 2 "U" shaped plines, finish the second one with "C".
Now paste that one line of code I posted to the command line, select the first one and observe the command line output. Now paste the code to the command line again, select the second one and observe the output. The first should return nil, the second should return <Selection set: c>...where the "c' cand be any hex number.