When Moriarty shakes Sherlock’s hand at the end, Sherlock cocks his head in a slightly puzzled manner, looking at him in confusion… at least, that’s what you realise when you notice that Moriarty used his right hand to shake hands with him, despite being left-handed (as we see earlier in the episode, with the teacup). Moriarty left his main hand free to grab his gun and kill himself, and Sherlock has just enough time to notice that.
THIS FUCKING SHOW YOU GUYS