lock pidfile, remove pidfile on INT or TERM