Chromatic aberration (actually transverse chromatic aberration) leads to coloured fringes in images (especially at the corners and edges of the image) and lowered overall sharpness. Apochromatic or "APO" lenses use special glasses to minimise chromatic aberration.
You might think that if aberrations are reduced as you stop down the image would get sharper and sharper as the aperture got smaller and smaller. But you'd be wrong.
In theory, with enough effort and expense, all these aberrations could be eliminated, or at least reduced to a point at which their effect would be very small. However, there is another limit on image quality (sharpness) which cannot be beaten even with the best possible optics and that is Diffraction.
Diffraction is the spreading out of light when it passes through an aperture (such as a lens). The smaller the aperture, the more diffraction and the lower the sharpness of the image. There is no way around this. Diffraction reduces image sharpness and as you stop down more and more, diffraction effects get larger and larger. Without getting technical, diffraction is the spreading out of a light beam when its "squeezed" though a small aperture. The smaller the aperture the more the light spreads out. One analogy is that of a garden hose. When the end is open water flows out in a narrow stream, but if you squeeze the end to form a small opening, the water fans out. The two phenomena aren't really related (different mechanisms apply), but the analogy helps to "get the picture" of what's happening.
Stopping down a lens greatly reduces spherical aberration and coma. But it has a small effect on the effects of astigmatism and field curvature, little or no effect on chromatic aberration and no effect on distortion. On the other hand, stopping down increases diffraction.
Therefore there is some optimum aperture for each lens, where the best balance between aberrations and diffraction is reached. Usually this will be around f5.6 for good, fast, prime lenses and between f8 and f11 for "consumer" grade zooms. A reasonable "rule of thumb" is that you need to stop a lens down about 2 stops from wide open to get maximum sharpness. There are, however, no hard and fast rules - each lens is slightly different.
While sharpness may peak (at least in the center of the image) between f4 and f8, stopping down to smaller apertures may still improve image quality in the corners of the image. That's because Coma and Astigmatism don't affect the center of the image, so the main effect of stopping down in the center of the frame is the reduction in Spherical aberration and spherical aberration goes way very quickly for a small decrease in aperture (It goes down by the square or cube of the aperture, depending on exactly how you quantify it). The effects of Coma and Astigmatism are reduced slower with decreasing aperture, so stopping down past f8 may further reduce their effects at the edges and corners of the image
There are other lens defects such as flare and vignetting. Flare results from internal reflections within the lens and causes images to be "washed out", or causes bright spots to appear when a bright light (e.g. the sun) is in the picture. Vignetting is when the lens cuts off light in the corners of the image. Both are usually improved by stopping down the lens.
See Chromatic Errors HERE