Write child's pid to pidfile