A privately retained counsel in any criminal case may, pursuant to the terms of a written agreement between the attorney and the client, withdraw from representation of a client without leave of court after certification of a charge by a district court by providing written notice of the withdrawal to the client, the attorney for the Commonwealth, and the circuit court within 10 days of the certification of the charge.