Soliton strings, the WZW model and modular invariance