Properly clean up GL resources before thread termination.

Ensures no gl calls are made on a thread which does not have an active
GL context.