Who talked about PCODE? I don't think the issue has anything to do with PCODE or not PCODE.

I am argentinian.

The crash will happen if you close the program without resetting the API hook to the original state.
Set PrinterFilePath = "" inmediately after the printing operation, and don't end the program before doing that.