That type of motor (usually) uses a small switch on a set of cams that are gear driven. Eventually your motor turns the swirch and kills power to itself.
That type of motor is called a linear actuator.