You need to prepend the publish EXE path to the filename, otherwise the file will be saved to the current directory, which is in a temp folder. Here is some code to get the full path to a file in a published EXE:
Code:
def getPublishedPath(filename):
publishPath = viz.getOption('viz.publish.path','')
if publishPath:
return '/'.join([publishPath,filename])
return filename
file = open(getPublishedPath('response.txt'), 'w')