Added function SaveVariableToFile to facilitate saving data from an parallel excecuted loop.