The statistical mechanics of near-BPS black holes