The American
(2010)

George Clooney rigs the gun, to kill the shooter.

The woman he sold it to dies as she tries to kill Clooney.

Clooney gets into a gun battle with his boss.

The boss gets in one shot and Clooney dies as he drives to meet up with his girl and flee.

Thanks Brian G!