fix pidFile not been writen error.