Changes in the cortical network during sleep stage transitions