The explanation is as follows
Smooth muscle sphincter of the common bile duct immediately proximal to the hepatopancreatic ampulla and organized into a superior and inferior sphincter; it is this sphincter that controls the flow of bile into the duodenum.
If it closes due to certain reasons then the flow of bile is obstructed and consequences are faced by the patient. One need to undergo medication or surgery in serious cases to that it.
Hope it answers your question.
All the best!