Add unittest for issue 9599, plus some other byLine cases
Fix unreferencing ByLine.file once empty

The file handle was not released for an empty text file.
Also, do not pretend empty() is const.
Don't assume wrapped range has a const empty()
Fix Issue 9599 - File.byLine doesn't function properly with take

Calling take could wrongly pop an extra line from the range.
Solved by making ByLine use reference-counting.

Note: Just changing ByLine not to eagerly read the next line was not
sufficient to handle all cases properly (plus that makes empty() less
efficient).

Note: ByLine was documented until recently.
Don't let ByLine degenerate to a ByLineImpl