The motor is attached to a "door", which rotates to block off an opening. I have it coded to manually go back 1/4 of a rotation, and the distance sensor attached will send it forwards 1/4 of a rotation. However, if it gets triggered twice, then it has to be triggered another two times in order to get back to the default position. I would like to avoid this. I am coding on a laptop, and there is no block that I have seen that can do this. Is this possible, or did I just miss the block?
Expanding on @zovits approach for a rubberband-based mechanical system: I'll suggest something like the following diagram, adding a rubber band between the bush and the belt wedge wheel:
That can technically be called a friction clutch. With something like that, it's possible to keep the motor turning more than needed: when the cyan liftarm hits the red corner beam, the axle will block and the rubber band will absorb the excess rotation (by means of slipping on the yellow bush).
In order to minimize wear&tear, you should adjust the rubberband tension so it provides just enough grip, but can slip easily.
I don't own any such pieces, and therefore I don't know how well they stand wear&tear - I'd recommend a rubberband just for the ease of finding replacements.
Another approach is to use a linear actuator:
A technic linear actuator has a built-in clutch, so will absorb extra rotation as well. That means you can run motor more than needed to get them into a known state (either fully retracted or fully extended).
By building an assembly as shown above (and securing both the motor and the black axle, but letting the linear actuator swing around the motor's axle), extending the actuator will make the black axle rotate about 90 degrees. You'll need to adjust the system to get the desired rotation angle.
For an ordinary motor it is not possible, as the axle position can't be queried from the software. What you can do though is to write your software in a way to return to the starting position before ending the program (define a counter for the number of trigger events, increase it every time, then at an appropriate point apply the necessary amount of reverse movement).
Another possibility is to build in a mechanical system that returns the axle to a pre-defined position (with force from gravity or a rubber band) and set the motor in feathering mode to let it turn without resistance until the starting position is reached.
The most convoluted way is to build your own position encoder: set up a sensor (push button, colour sensor or ultrasonic) that can tell when the axle is in the starting position, then when resetting, turn the motor while querying the sensor until the starting position is reached.
Drive the motor at low power for some length of time in a direction until the door jams against some obstacle. Set the position sensor of the motor. Drive the motor to the desired starting position relative to the jammed position.
This violates one of the constraints of the questions, since this would run before you ran your code. However, it is simple.