Even if you set Code Protect ON, you can still reprogram them hundreds if not thousands of times. All Code Protect does is prevent the code from being read back.
I have noticed some Flash PICs will fail to reprogram unless they are ERASED first. You may want to try that.
Bookmarks