it is very simple, if you are trying to provide security,to your customer you should hide your code so other people won't see the tricks you have done to achieve that level of security and so it wouldn't be easily hacked. Linux for example claims it is very secure but if it is open source then any one can get a copy of the code and read through it to discover a way to hack it.
I strongly disagree with your analysis.
1. Code and algorithms being openly available means that bugs are more likely to be found and fixed. A good example is cryptographic standards. You can read a full description of the AES encryption algorithm, which is widely used in many kinds of secure systems (including Windows), here -
http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf . This is generally seen as making it more, not less, secure. This short essay is worth reading -
https://www.schneier.com/essay-056.html .
2. Security is more often based on secret keys (i.e. numbers) and secure hardware features (e.g. processors that will only execute code that is cryptographically authenticated, very secure memory). Relying on secret algorithms (i.e. computer code) is a bad idea as once they are leaked (and it only takes a single leak anywhere that code is stored or used) or derived by a hacker, any security inherent in the secrecy has gone.
3. If I'm buying a secure system, I may have legal or commercial requirements to ensure it offers a sufficient level of security. How can I do that without assessing how it works?
This doesn't mean that open source software and other 'open' systems are inherently more secure, or that closed systems are less secure. But openness can certainly bring major security advantages, simply by allowing a system to be widely assessed by many experts.
EDIT: another advantage of open source systems is that it is easier to see whether any security flaws have *deliberately* been added to the software. It has been suggested that government security agencies have made companies do this, or even that some companies do it for their own commercial benefit. Hiding backdoors in open source software is much harder than in proprietary software.