Add a file pointer check.