Where the director of public prosecutions or, as the case may be, deputy director of public prosecutions or a person duly authorised by the director or deputy director in writing in that behalf, either generally or in a particular case, advises the court to which a defendant has been committed for trial that the director or deputy director will not be presenting an indictment against the defendant the defendant is thereby discharged from complying with the conditions specified in the defendant’s undertaking and to which the undertaking is subject pursuant to this Act and thereupon the undertaking shall cease to have effect.