Check for existence of UIDNEXT before casting to long.

If unavailable, get the UIDNEXT value from a separate folder_status call.