This happened to me since last week. I thought PKHex was doing maintenance or something. So I deleted it. I downloaded it again earlier today and the same ERROR still pops up.
I posted about this and while waiting for replies, I tried looking for ways to fix this.
I came up with a post that says, if there are bugs in saving files, maybe I need to download .NET.
I tried to download it, and restarted my laptop. And this time it finally worked.
Not sure if it was really .NET, but I suggest you try it.