fix on cleanup_fail command, better non-buffered line read that does not result in spurious errors re: filehandle close