WriteProgramCode and WritePkgCode: return write errors (#59)