gl: avoid overwriting display and context to NULL