Merge pull request #2164 from Armada651/cache-fix ProgramShaderCache: Do plenty of error checking before writing shaders to the disk.