When resetting NAG_ERROR, don't overwrite the callback pointer.

Also:

 - add support for getting the most recently thrown NAG error.
 - reset the error buffer before calling nag_opt_lp.

[ with touch-ups by @StefanKarpinski ]