Synchronization in time-varying networks