Move log message

This helps reduce a race condition reported in test1.64. Log termination
message right away rather than trying to terminate the job and then
log the event before the srun program exits
Initialize some variables to be safe