VF Setting with Script, family name not set

Hello! I wrote a script to automatically add the variable font setting with “Localized Family Name”, “PostScript Variable Name Prefix” and the custom parameter “File Name”.
When running the script everything works fine, but there is no name ID 1 (“Localized Family Name”) written in the name table of the exported variable font.
Am I missing something?
Here is the script:

#MenuTitle: Add Variable Font Instance
# -*- coding: utf-8 -*-
__doc__ = """
Add Variable Font Instance with all necessary Parameters and Propoerties.
"""

# This script sets Properties and a Custom Parameter for the Variable Font Instance in Glyphs 3.
# Constants for instance type and angle threshold
from GlyphsApp import INSTANCETYPEVARIABLE
from GlyphsApp import INSTANCETYPESINGLE

# Get the current font
font = Glyphs.font

# Function to determine the correct name for the Variable Font Instance
def determine_instance_name():
    italic_angles = [master.italicAngle for master in font.masters if master.italicAngle is not None]
    
    if all(angle != 0 for angle in italic_angles):
        return "Italic"
    elif any(angle != 0 for angle in italic_angles):
        return "Regular"
    else:
        return "Regular"
        
# Retrieve the family name from Font Info > Family Name
family_name = font.familyName

# Check if "Beta" is in the family name, and modify the localized family name accordingly
if "Beta" in family_name:
    localized_family_name = family_name.replace("Beta", "VF Beta")
else:
    localized_family_name = f"{family_name} VF"

# Construct the Variations PostScript Name Prefix and fileName based on italic status
if determine_instance_name() == "Italic":
    postscript_name_prefix = f"{family_name} VF Italic".replace(" ", "")
    file_name = f"{family_name} Italic VF".replace(" ", "-")
else:
    postscript_name_prefix = localized_family_name.replace(" ", "")
    file_name = localized_family_name.replace(" ", "-")

# Construct the fileName by replacing spaces with hyphens
#file_name = localized_family_name.replace(" ", "-")

newVariableInstance = GSInstance(type=INSTANCETYPEVARIABLE)
#set the instance name depending on the italic angle
newVariableInstance.name = determine_instance_name()
# Set the Localized Family Name
newVariableInstance.familyNames["Default"] = localized_family_name
# Set the custom parameter for fileName on the instance
newVariableInstance.customParameters["fileName"] = file_name  # Set fileName as a custom parameter
# Set the Variations PostScript Name Prefix as a custom parameter
newVariableInstance.properties["variationsPostScriptNamePrefix"] = postscript_name_prefix

Font.instances.append(newVariableInstance)

print(f"Added new Variable Instance")
print(f"Localized Family Names: {localized_family_name}")
print(f"Variations PostScript Name Prefix: {postscript_name_prefix}")
print(f"fileName: {file_name}")

name table starts with nameID 2: