Once our program has finished we should destroy all windows and close the display. The required function calls are
XDestroyWindow(display, window); XCloseDisplay(display);