Check file object to prevent error when file has been deleted