A Compactness Principle for Bounded Sequences of Martingales with Applications