7.2.2 Close a window without closing the document

Finish active prompts, then select the view you want to remove and check its buffer with C-e m. Press C-x 0: Control-x, then the digit zero. This removes the selected window, not its buffer or file. Select the buffer again with C-x b when you need it.

To keep only the selected view in the frame, use C-x 1 instead. The other buffers remain available and unsaved text remains unsaved. These layout commands are neither file saving nor undo. If Emacs cannot remove the last ordinary window or a specially managed view, follow its explanation rather than closing Emacs to force the layout change.

C-x k has a different purpose: it kills a buffer, with any applicable unsaved-work prompt. C-x 4 0 kills the buffer as well as its window; it is not a longer spelling of C-x 0. Likewise, q belongs to the current mode: in a plain document it usually inserts a letter, while Help, Info and Dired have their own return commands.

See Deleting and rearranging windows in the GNU Emacs Manual for the full set of layout operations. Keep Buffers hold your work as the reference for buffer selection and closing work itself.