Sometimes, even a bad investment can be a good thing. That's because there's a practice called tax-loss harvesting. Tax loss…