Fix a race when unregistering prunejobs.