Perturbative string thermodynamics near black hole horizons