Your limit switches inside the motor are dirty/bent, you have a lot of dirt that does not allow the worm shaft to slide properly, or your nylon gear has some teeth missing.
The center worm shaft of the motor will move slightly up or down and open a metal contact when the headlight reaches full up or full down.
To fix it you need to remove the motor and drill out the rivots. You can then use new rivots or some folks will put them together with screws and nuts.
The biggest problem is the nylon bushings that the gear runs on deteriorate and pieces get caught by the switches and cause them to not work.
You can buy a rebuild kit for these at:
http://rodneydickman.com/catalog/product_info.php?cPath=32&products_id=230
These include the new bushings and a metal gear. Also if you click on the link above there is pics of what the inside looks like and links to step by step instructions on how to open, rebuild, clean, and reassemble the motors. Rodney uses delron bushing (they don't wear away) and metal gears (no teeth crack off).
I should also note that if you want to clean and regrease the motor without buying a rebuild kit and you find some teeth missing from the gear, Just remove the gear and spin it 180* and re-install it. The motor only uses half of the gear to open and close. So if one half is stripped you can get away with using the other half.