In OS X development, the developer can program the application to Terminate when the last window is closed. If there is a single window present, and you click its red traffic light, then the application will quit. Otherwise, it is a signal to close the window, and its open document. In this case, the window is gone, and the document will need to be reopened via the File menu : Open..., or File menu : Open Recent sub-menu.
The yellow traffic light is intended to minimize the open application window (and document) to the Dock. Depending on the Dock preferences setting, it may minimize to a icon version of the window contents to the right-hand side of the Dock, or simply minimize into the actual application icon. In either case, clicking on the application, or Dock icon will restore the original window and contents.