what muscle opens and closes the nostrils
The nasalis is a sphincter-like muscle of the nose whose function is to compress the nasal cartilages. It is the muscle responsible for flaring of the nostrils. Some people can use it to close the nostrils to prevent entry of water when underwater. It consists of two parts, transverse and alar :