Issue #2655204 by bearArthur: Added condition to check file is loaded. Replaced file_load() function with \Drupal\file\Entity\File::load().