Which trigger are you using?
But I don't think that matters... The script linked to the button will be executed before any trigger ...
That's normal and to be expected. A button click is just another event and that event happens before the user is taken out of the field that would trigger your "on exit".
If you want to make sure the "on exit" is handled properly then the first step in your script attached to the button would be to do a commit.