Problem in saving data to csv

So i built a Stroop experiment.
It all works fine but it saves three different spreadsheets which all are blank from value.
anyone know why?
Thx.
here the code:

from psychopy import visual, data, gui, core, event
from psychopy.hardware import keyboard
import os 
from datetime import datetime
from csv import DictWriter


#duilog box:
exp_info= {'Expdate': datetime.now().strftime('%Y%m%d_%H%M'), 'ID': '', 'Age': '', 'Gender': ''}
dlg = gui.DlgFromDict(exp_info, title='Input participant info', fixed='Expdate', order=['ID', 'Age', 'Gender','Expdate'])


#Setting
answer_keys = {'right': 'red', 'left': 'blue', 'up': 'green'}
filename = 'stroop-{}-{}-{}-{}.csv'.format(exp_info['ID'], exp_info['Age'], exp_info['Gender'], exp_info['Expdate'])
file = open(filename, 'w')
csvfile = DictWriter(file, fieldnames = exp_info)
csvfile.writeheader()
thisExp = data.ExperimentHandler(name = 'Your expt', version='',
    extraInfo = exp_info, 
    dataFileName = filename)

#Setting window:
win = visual.Window( fullscr = True, \
                    allowGUI=True, color = (-1, -1, -1))
stim= visual.TextStim(win)

# Instructions:
insturctions = visual.TextStim(win, ' Stroop Task\n Choose the right color Name and ignore the actual color\n Right=Red  Left=Blue, Up=Green.\n Press space when you are ready')
insturctions.draw()
win.flip()
event.waitKeys(keyList=['space'])

# Setting trials:
trials = data.TrialHandler(nReps = 1, method = 'random', 
    trialList = data.importConditions(r'c:\Users\New\Desktop\trails.csv'),
    name = 'trials')

thisExp.addLoop(trials)

for trial in trials:
    stim.text = trial['color_text']
    stim.color = trial['color_name']
    stim.draw()
    displaytime = win.flip()

    key, rt = event.waitKeys(keyList = answer_keys.keys(), timeStamped = core.Clock())[0]

    #saving data -not working
    thisExp.addData('rt', rt)
    thisExp.addData('response', key)

    thisExp.addData('correct', answer_keys[key] == trial['color_name'])

#wraping up 
thx = visual.TextStim(win, ' Experiment completed. \n Thank you')
thx.draw()
win.flip()
core.wait(2.0)
core.quit()

these are the exported files:image
and this is what one of them contains.
image

You don’t call thisExp.nextEntry() at the end of your loop.

Have a look at the documentation for ExperimentHandler.