Added begin_file, end_file method and modified to abend when the exception is caught