This fixes #7945.  It now drops pid files if it can.