が終わり

ends

→ が
phrase Rare #43,714
ends が marks what is ending. が終わり can connect to what happens next; with 次第, が終わり次第 means “as soon as … is finished.”
JA: 会議が終わり、みんなで昼ごはんを食べました。
EN: The meeting ended, and we all had lunch together.

あっちが終わり次第、手伝うよ。

I’ll help as soon as I’m done over there.

暑い夏の日が終わり涼しい秋の日が続いた。

The hot days of summer ended, and cool autumn days followed.