Only display the window when necessary

This gives more time to the interpreter, especially if displaying the
window would result in a vsync