To close or disconnect a display from the X server, use close-display.
A display object.
Closes the connection to the X server for the specified display. It destroys all server resources (window, font, pixmap, colormap, cursor, and gcontext), that the client application has created on this display, unless the close down mode of the server resource has been changed (see set-close-down-mode). Therefore, these server resources should never be referenced again. In addition, this function discards any output requests that have been buffered but have not yet been sent.