Uncertainty-Based Abstention in LLMs Improves Safety and Reduces Hallucinations