Light motion automation

I copied the following automation and then changed it slightly so the lights would turn off after 1 minute if no motion detected (if motion or door opened then light would stay on until no motion or door closed). Ubfortunatly the light just stays on, I tried adding a light_off command after the “until” loop but I get a block error…any ideas on what needs changing?

- alias: auto hallway lights motion
  trigger:
    - platform: state
      entity_id: &sensors
        - binary_sensor.motion_sensor_hallway
        - binary_sensor.front_door
      to: "on"
    - platform: state
      entity_id: *sensors
      to: "off"
      for:
        seconds: 15
  condition:
    - condition: template
      value_template: "{{ state_attr('sun.sun', 'elevation') < 0 }}"
    - condition: state
      entity_id: alarm_control_panel.yale_smart_alarm
      state: "disarmed"
  action:
    repeat:
      sequence:
        - service: "light.turn_{{ trigger.to_state.state }}"
          entity_id: light.hallway_lights
      until:
        - condition: state
          entity_id: binary_sensor.motion_sensor_hallway
          state: "off"
          for: 00:00:15

so I tried adding the following to the end so it would turn off the light when no motion detected for 15secs:

  - service: light.turn_off
    entity_id: light.hallways_lights