:x
:x will write the current file only if there have been modifications to the file and then quit the window.
:w will write the current file even if there haven't been any changes since the last write.
To write all changed files and quit all windows you can use :xa.
:x is equivalent to :xit, :exi, and :exit