Duration of closed stochastic epidemic