Improve error handling in fileRecord.go