Most of the open-ended contracts I have worked on include the three following conditions:
- Work ends immediately if both parties agree that the work has been completed
- The freelancer must give 30 days notice if he decides to stop working on the project before the project is complete. You can adjust this down to 14 or sometimes even 7 days for a smaller project; obviously both parties should agree on the duration of the notice.
- If the client decides to end the project before the work has been completed, work ends immediately but the client must pay for all work completed thus far. If this was an hourly contract, the client pays you for any hours you worked that haven't already been paid. If you are working by milestones, this includes partial payment for any partially completed milestone for which you otherwise wouldn't have been paid until the milestone was completed.
As an example of the last condition; let's say that the final milestone is to add a News page, and the price for this milestone is $1000 to be paid when you complete the News page. When you are halfway completed with the page, the client decides they don't want to finish the site, and they cancel the project. They have to pay you $500 for the 50% of the milestone that you completed. This does not apply if you cancel the project and the notice period ends with a feature partially completed.
Occasionally on a large project, you can get away with requiring the client to give x days notice before canceling the project, or else to pay an early termination fee on top of any payment for work completed thus far. The idea here is to cover your losses from suddenly losing a planned source of income and having to find a new client.
On a milestone project, you can probably also say that the work is completed when all milestones have been completed. If the client is expecting to add additional milestones down the road, you can add a clause that additional milestones have to be agreed upon by both parties, or that they become a separate project with a separate termination date.