Files are flushed and closed. Another way to exit is to type the end of file character, which is typically set to Control-D in unix systems, and is Control-Z under MS-DOS.
See also exit.