I know of no automatic setting, but you could easily remove self-registration yourself a day before the course expires. I don't do this, but if I were to do it, I would put a reminder in my calendar so that I would not forget.
So, are you saying that you do want to allow a student to self-register 25 hours before the course ends, but not 24 hours? Your question makes me wonder what you are trying to prevent.