You can close a document either by clicking on the red widget at the top left corner of the window, by selecting the
close command which is found under the
File menu, or by using the Command W keyboard shortcut. (The command is next to the spacebar, the key with the cloverleaf or apple icon.)
In the Windows world it is typical for an application to quit when the last document is closed. This is
not the norm for the Mac. However because this is the Windows norm, lots of Windows users assume it is the Mac norm as well. Also, because the Mac has no application layer, it is easy to click on the desktop, moving your focus to the Finder and away from the running application. Two hints I always give to new Mac users are 1) pay attention to the Application menu, it shows you which program is currently running, and 2) be careful about where you click - especially take care about clicking the mouse outside of a window since this changes the focus to another window and often to another program. This can be confusing but is also a powerful tool.