ToReMi: Topic-Aware Data Reweighting for Dynamic Pre-Training Data Selection