Check very carefully the rules for early withdrawal.
Some investments are traded at a market rate. Say you invested $10,000 for 2 years at 5.0% interest rate. Obviously you will get two interest payments of $500 plus your $10,000 back after two years. But if you try to sell this investment, you don't get $10,000 plus interest, you get the current market price plus interest.
If the interest rate stayed 5.0%, the market rate will remain $10,000. If after a year the interest rate is 6%, then you can expect $500 interest for the next year, while a new investment would get $600. So nobody in their right mind will give you $10,000 for your investment, they will give you $9,900. On the other hand, if interest rates dropped to 4%, then a new investment will pay only $400 interest in a year, so people will be willing to give you $10,100 for your investment which pays $100 more interest.
In the end, you have to calculate what you will get for your old investment, and which interest rate a new investment would pay, and act accordingly.
But also longer investments tend to pay higher interest rates. So if you have a five year investment and sell it after two years, the bank won't be willing to pay you the higher rate that was reserved for "five-year" customers, so there will be a penalty in your contract that you will have to pay to get your money back early.