Nonlocal Theory of the Optical Properties of Thin Metallic Films