Fix opengl crash when goroutine switches thread contexts