Update FileIO

Add error handling location and an end loop