Controller Hang whenever execute both functions(Parsing File and Writing File)

Don't do this

    if (myFile) {

it is at least a bug waiting to happen. You should always use an explicit test such as if (myFile!=NULL)

Mark