Nearly optimal central limit theorem and bootstrap approximations in high dimensions