Though the trade paperback has a movie photo on its cover, it's a real novel written by Dennis Lehane a few years ago. (He was also listed as associate producer on the movie, so I figure it has his blessing to some extent.)
I confess that I skimmed the last chapters a bit, and
so it looks like the book probably has the same denouement as the movie.