Various error-handling fixes, mostly in Unix PuTTY but one (failure