If the course is open entry (students can enrol at any time) it is a difficult problem. Changing the enrolment key periodically (weekly?) might work but it would probably cause more problems that it would solve.
If students will enrol at one time at the beginning of a course you could set a date range for enrolment. Outside of that date range students would not be able to self enrol.