doOnBeforeTerminate

Calls the action when the Observable signals a terminal event: onComplete or onError. The action is called before the observer is called.

Please refer to the corresponding RxJava document.