A scalable flow-based approach to mitigate topological freezing