The suffix code looks like it's trying to add a suffix after the .rar extension and adding a .rar to the entire file name after the suffix.

No idea though, on why the rename fails. I haven't tried it.