Using internal and collective variables in Monte Carlo simulations of nucleic acid structures: Chain breakage/closure algorithm