The only reason He did it, is because he realizes he could lose reelection big time.
And knew it would pass anyways. It is common practice by both parties to allow certain representatives to vote against or for a bill as a feel good measure for their constituents if they know it will go the way they want it to anyways.