Make pidfile writing "more" atomic.
am: 255a8e2879

Change-Id: Idcdab2d51f241cf2141dfaae73b9fa67da96207a