Terminal Emulation - Session Closing


I am automating a process with a TN3270 terminal that is involved.

However, what is happening whilst developing is that the session closes after I am done keying in commands and outputs to a sequence. The problem I am having with this is that I am unable to modify any of the commands/code unless I start a whole new sequence (and consequentially, have to start from beginning).

Can anyone help me clear up this issue?

Thanks again.