Added locking to context load/render.
Program now exits when escape is pressed.