Stability in Time-Varying Ecosystems