Seismic inversion is aimed at building a mapping from low-resolution seismic data to high-resolution impedance data. Most of the traditional methods have satisfactory interpretability, and most parameters tend to have specific physical definitions. On the other hand, deep learning-based methods present poor interpretability as their prediction performance is not always clearly explainable. One of the significant challenges of the deep learning-based methods is to quantify the uncertainty of the model. The uncertainty includes aleatoric uncertainty and epistemic uncertainty, and epistemic uncertainty can be used to evaluate the predicted accuracy of the trained model. In this paper, we propose a new deep learning model called uncertainty backpropagation network (UB-Net) to perform impedance inversion. The proposed UB-Net is based on a closed-loop framework and can predict the impedance and the epistemic uncertainty simultaneously. UB-Net has three closed-loop data flows, whereby the predicted uncertainty is utilized as the weight of loss functions to improve the inversion accuracy. Experimental analyses demonstrate that UB-Net presents advanced inversion accuracy on both synthetic and real examples. Specifically, the mean absolute error (MAE) on synthetic examples drops by 40%, and the Pearson correlation coefficient (PCC) on real examples increases by 2%. Besides, compared with existing approaches, UB-Net presents superior spatial continuity and preserves more geological structures such as little faults in real examples.