Modular invariance of string theory on AdS3