The formation of molecules in protostellar winds