A ている + ところ means "while doing A". This meaning is similar to the usage of Verb A + あいだ (間)to indicate "while". However, while the former is usually used at the end of a sentence
本を読んでいるところです。
the latter can be used to connect two clauses with the particle に:
トイレに行っているあいだに電車が行ってしまった。
That is the reason why the correct answer is あいだ in spite of having a similar meaning.
As for the nuance of "about to", it requires the verb before ところ to be in its dictionary form rather than the ている form, therefore the translation should be "I was going into the bathroom... ", rather than "I was about to go in the bathroom...".
The しまった or しまいました is attached to the end of a verb sentence in て form in order to convey a feeling of regret because the outcome of the verb is not pleasant or desired. In this case, the speaker regrets that the train went away, probably because he or she wanted to get on the train but couldn't.