本を読んでいた(I believe you can't drink any book.
)
Those two expressions are totally different in meaning. AあいだB means "B throughout A". A and B are both state, -te iru form or durative verb. Whereas AあいだにB is "B happens/occurs/is done at a point of time of A". In your example sentence, the subject was reading a book all the way on the train, therefore あいだ is the correct answer. If the main clause is 本を読み終えた, the answer is あいだに, since 読み終えた refers to the moment they finished reading the book.