Evolution of transverse modes in a high-gain free-electron laser