simplify pidfile writing