save the JSON file , but Auto RESTART the game?

anyone know why when i save the JSON, the game restart ? why?

coding:

[code]

local savedata =function(theFile,base)
if not base then
base = system.ResourceDirectory;
end

local path = system.pathForFile( theFile, base )

file = io.open( path, “w” )
if file then
contents = json.encode( gamelevel )
file:write( contents )
io.close( file )
end
end [import]uid: 22631 topic_id: 26568 reply_id: 326568[/import]