Fix disposing of ShaderProgramCache

Fixes issues #1071, #1181
Was trying to release managed objects in the finalizer.
Also fixes project templates for Windows and Linux to always properly dispose of the Game object.