が終わり

when ... ends

→ が
phrase Rare #35,242
when ... ends Follows a noun or noun phrase to indicate that something ends, often connecting it to what happens next. In formal or literary writing, it can mean “with ... ending” or “after ... ends.”
JA: 長い会議が終わり、みんなで昼食を食べに行った。
EN: When the long meeting ended, we all went out to lunch.

骨の折れる闘争が終わり癒し静けさを襲う

The grueling struggle ends, and a healing stillness washes over him.

— バーフバリ 伝説誕生 (2015)

が終わり明かりがついた

The curtain fell, and the lights came on.

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

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

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

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