To get the full benefit of a tax-free investment, you should leave your money invested for as long as possible.