He came near betraying and upsetting the whole business, by his careless letting a neighbor woman see him."
He was close to ruining the entire endeavor by his thoughtless allowing a neighbor to catch him in an intimate moment.