Fixed bug when writing out process id and avoid backing up duplicate log
files