Fixes crash when ^C+ENTER issued on password request.
Use of error codes instead of string matching to detect session expiration.