Energy transfer mechanism of the instability of an axisymmetric swirling flow in a finite-length pipe