To save a file in Vi you can type the following:

:wq!