def save_file(self, remote_file, share_name):
        """This function reads the `remote_file` in chunks using the `read_chunk` method.
        Each chunk is then written to the local file until the entire file is saved.
        It handles cases where the file remains empty due to errors.
        """

        # Reset the remote_file to point to the beginning of the file.
        remote_file.seek(0, 0)

        folder, filename = self.get_file_save_path(remote_file)
        download_path = os.path.join(folder, filename)

        # Create the subdirectories based on the share name and file path.
        self.logger.debug(f'Create folder "{folder}"')
        make_dirs(folder)

        try:
            with open(download_path, "wb") as fd:
                while True:
                    chunk = self.read_chunk(remote_file)
                    if not chunk:
                        break
                    fd.write(chunk)
        except Exception as e:
            self.logger.fail(f'Error writing file "{remote_path}" from share "{share_name}": {e}')

        # Check if the file is empty and should not be.
        if os.path.getsize(download_path) == 0 and remote_file.get_filesize() > 0:
            os.remove(download_path)
            remote_path = str(remote_file)[2:]
            self.logger.fail(f'Unable to download file "{remote_path}".')
This function reads the `remote_file` in chunks using the `read_chunk` method.
        Each chunk is then written to the local file until the entire file is saved.
        It handles cases where the file remains empty due to errors.
        
cme/modules/spider_plus.py