Stop position circuit for pwm regulated DC motor (bi-directional)
This type of thing is usually handled with a traveller arrangement like the flowing.

Motor rotates a screw with a threaded traveller (Restrained nut). Two micro-switches are positioned where you want the power to be cut. 

Usually either the position of the switches is made adjustable with slotted holes for clamping screws, or two nuts are used and rotated to the appropriate offsets with the restrainer removed.



The switches are then wired to disable the appropriate drive direction.