Been there, done that.
What you're looking for is "Agile Development" that typically runs in 3 week sprint. There's ton of project management tool but the one I've used is called "VersionOne". It's really nothing fancy. You create User Story aka requirements then you give points based on risks (time/new technology/dependencies), then you break user story into tasks and assigned to team members. Each team member will come up w/ best estimated time to complete the task. If you keep iterating this w/ each user story then you'll know how much you can take per 3 weeks sprint. If your team is new to this then expect that their estimation to be way off. On each sprint iteration, you'll get better at estimating.
I still haven't answered your question "When do you code freeze?" What we did is that we dedicate 1 Sprint (3 week) to refactor/test/improve performance. We also made refactor/test/improve as a User Story with points. Customer should not be able to request new feature unless it's extremely important or something that's relatively easy. If your customer does ask you to do something then you create user story and give it a point. Say your team is commited to 450pt for Sprint 10 then your customer must make sacrifice on other task that won't be done.