Metastable Dynamics and Learning in Balanced Cortical Networks