log close and termination added.