+1
Thinking about it further, it seems as if the film gradually transitions from a more objective reality with an old school Westernish style into a subjective nightmare as Jim is put through the proverbial gauntlet by Ryder's psychological sadism. So by the end, Ryder is very much an incarnation of evil & chaos & darkness in Jim's mind, not merely a psycho but an almost supernatural embodiment of evil for Jim, and Jim's response is to become the opposing archetype and destroy Ryder.
I recall a line in the movie where the sheriff says there's "something going on between you two", and I think that makes it clear that both Ryder & Jim come to represent over the course of the movie something more abstract than mundane appearances and motives would indicate. Jim's superficial motives for killing Ryder may be revenge, but there's a deeper sense of closure in the act, beyond just that, and it's affirmed by how the climax is presented, which would otherwise seem exaggerated and unrealistic.