fix write  pid file bug.