private void closeScenario() {
    if (currentScenario != null) {
      if (isRealScenario(currentScenario)) {
        if (scenarioPassed) {
          passedScenarioCount++;
        }
      }

      if (!scenarioPassed) {
        outCommand(TEMPLATE_SCENARIO_FAILED, true, getCurrentTime());
      }
      outCommand(TEMPLATE_SCENARIO_FINISHED, true, getCurrentTime());
      outCommand(TEMPLATE_TEST_SUITE_FINISHED, getCurrentTime(), getName(currentScenario));
    }
    scenarioPassed = true;
    currentScenario = null;
  }
private void closeScenario()