ENH: _copy_lines_between_files -- read all needed, and only then write/flush at once