The head cover of a pen is simply called a “cap”, sometimes “pen cap. This applies to the common pressure cap of a pen and to the screw cap found on the fountain pen (both ink and cartridge), which are rarely used today (although the fountain pen still has devoted users). You've probably never thought much about it, or if you have, you've probably ignored it as a random design feature that regulates air pressure or prevents ink from drying out. And yes, having a hole allows you to close the lid properly without air pressure problems.
But it also has another simple but ingenious purpose: to reduce the risk of deaths from asphyxiation. I've heard the cover and cover of a pen, and while I'm doing a little more research on this question, it seems that one more word is also used.