well when constructing a rectangle you could use the Rectangle Sketch tool, but the problem you are facing is in the way you click.
To draw consecutive sketch lines you click (pressing and releasing the mouse button), move the mouse click, and repeat.
To draw a single nonconsecutive sketch line you click (press down without releasing the mouse button), drag the line out to length, and release the mouse button.
With that said you would probably want to press Escape after you connect the last line of your rectangle or right-click and select end spline. You can however double click to stop sketching but make sure the double click threshold (time between clicks) is set to accomodate your double clicking speed. this can be done in your mouse settings.
This has been discussed a couple times before, here was one of the threads, I could not find any of the others:
Don't "double click" to end the square. Just single click. You are accidentally either double clicking, or moving your mouse while continuing to click for that last endpoint.
I do not know of a setting to adjust the tolerance for how short a line segment can me.