The arrangements for terminating the agreement can be agreed between you and the distributor, and should be clearly stated in the written agreement. The agreement should state which terms (eg confidentiality) will continue after the termination.
The agreement should also deal with how the distributor's remaining stock of your product will be handled: for example, whether they will be allowed to continue selling it for a specified time, or whether you must buy it back from them.