Compensation of the charging currents of a piezoelectrically driven resonator