High probability generalization bounds for uniformly stable algorithms with nearly optimal rate