You can unstake funds at any time. Rewards will stop accruing after the staking is closed, but you will get back the amount you used based on your selected staking option and unbonding period.