Pressing the red 'X' button should keep the app open in the dock and only close the window. To quit the application entirely, right-click its icon in the Dock and select 'Quit,' or navigate to the first menu to the right of the Apple menu (named after the application) and select 'Quit' (or use the shortcut CMD+Q).