Even Apple is confused when it comes to the red button:
Click the red close button in the top-left corner of the window, or press Command-W.
When you click the close button in many apps, such as Photos or Notes, you quit the app. Other apps, such as Safari or Mail, remain open when you click the close button (only the window closes). To quit these apps, click the app’s name in the menu bar, then choose Quit [App]. For more information, see Quit apps. [Source: OS X El Capitan: Window basics ]
In the menu bar, when the app is active, choose App Name > Quit App. For example, choose Mail > Quit Mail.
Note: When you click the red close button in the top-left corner of an app’s window, the window closes, but the app remains open.
[Source: OS X El Capitan: Quit apps ]
It's all a wee bit confusing. I'm sure the red button used to be described as "Hiding" a window. Now it's "Closing" a window, which seems incorrect because it really acts the same way as "Minimising" a window using the orange button, but without the animation (if you left that turned on).
Third party programs, er apps, are a whole other kettle of fish subject to the whims of the developer.