Yeah, that part really surprised me too. He had advanced degrees and top grades, so he was clearly a smart guy, so why did he make such a dumb mistake that anyone who's watched a few murder mysteries would know not to do? Like some others have said, it seems like he probably wanted to get caught.
It sounds like he had a mental break. Not saying he didn't have good reasons for doing what he did, but the twitter detectives posted that his family and friends have been looking for him for the past 6 months.
You can be smart and still slip up, especially under pressure (and as we're learning, possibly mental and physical pain). Presumably one of the reasons why professionals are better is that, beyond working experience, they have a lot of practice.
(In Dr. Strangelove voice) "Of course, the whole point of a ghost gun is lost if you keep it!"
Seriously tho, the fact that he went to the trouble of obtaining one shows that he gave that some thought. But then didn't follow through. So yeah, maybe he did want to get caught.