The car was filthy when he returned it to me, and 'to cap it off' [='to top it off'], there was almost no fuel left in the tank.
a 'shower/bathing cap' [=a head covering that people wear to keep their hair dry when they are showering/swimming]
They may not like being called careless, but 'if the cap fits, wear it'. [=('US') 'if the shoe fits, wear it']
(..) I'll make a deal with you. Instead of this petty charge, you could get something really big... ...that would chuck him in a camp for years. That'd be a feather in your cap. It certainly would. Germany- Vichy would be grateful. Then release him. Be at my place a half-hour before the plane leaves. (..)1942 Casablanca