fixed pid-file race condition