Fighting topological freezing in the two-dimensional CPN-1 model