File Open/Close
Counting lines with for loop
FileName, print Error

FileName variable
try/except- print Error
with.. open .. as

With command included as it does not require file.close
The code is restructured