行ってしまっていた

had already gone

→ 行く
phrase Rare #34,122
had already gone Expresses that someone or something had already left or gone by a certain past time. しまう can also add a sense of finality or regret, but here it mainly emphasizes that the departure was already complete.
JA: 駅に着いたとき、電車はもう行ってしまっていた。
EN: When I got to the station, the train had already left.

駅へ着いた彼の乗る列車は行ってしまっていた

When he arrived at the station, the train he was supposed to take had already left.

私が停留所に着いたときには最終バスはもう行ってしまっていた

By the time I got to the bus stop, the last bus had already left.

当時は外国へ行ってしまっていたのを知らなかったのですか

Didn't you know that they had gone abroad by then?