Vim From Scratch
How To Exit Vim
How to quite Vim?
Well, there are multiple options.
That largely depends on whether you want to abandon the changes you made or save them.
First, press Esc to get back to normal mode.
:qa!to close all files and quit abandoning all the changes:wqato save all files and quitZZin normal mode writes the current file and exits:xsame as above
Learn more
There's not much more to it, but if you want, you can read help docs :help quit, which is always a good idea.