code: function endActivity(activityId) {
    markActivity(activityId);
  
    var activity = destroyActivity(activityId)
  
    writeActivity(activityEvents.end, activity);
  
    return activity;
  }
docs: End an activity. Log the time, write output, and then delete activity.
  @param {number} activityId Activity ID.
  @return {Activity} Return the ended activity.