Calculating filter coefficients of a Moving average with error correction
Simply add a compensating gain at the output of your recursive moving-averaging. This compensating gain can be updated on the fly. 

Adding an varying input gain at the input of the recursive implementation would also work, but it would take more time for the gain change to be effective, it would take "N" samples for the change to be applied 100% where N is the tap length of your moving-average.