delete-terminal

delete-terminal is a built-in function in `C source code'.

(delete-terminal &optional TERMINAL FORCE)

Delete TERMINAL by deleting all frames on it and closing the terminal.
TERMINAL may be a terminal object, a frame, or nil (meaning the
selected frame's terminal).

Normally, you may not delete a display if all other displays are suspended,
but if the second argument FORCE is non-nil, you may do so.