preserve $lastexit code in function prompt()

$LASTEXITCODE gets clobbered by something in the prompt function. Save it and restore at the end.