How close to the edge of a window, that a scratch can be removed, depends on several things.
For clarity, if the piece of glass is removed from the frame, then the complete scratch can be removed (in general). Removing the glass is a highly unlikely occurrence in most circumstances, but I wanted to point out this possibility, as there are indeed times where this option is available and makes sense.
The primary consideration as to how close a scratch can be to the edge of the frame around the glass, and be removed, is the depth of the scratch.
The lightest scratch you can see might only need a bit of polishing to be removed. In a scenario such as this, with only polishing needed to remove the scratch, it might be possible to get as close as 1/4 inch.
If any sanding is needed to resurface the glass to remove the scratch, a good rule of thumb is 2 inches from the frame. If the scratch is excessively deep, it could even be up to three inches away from the frame. This is a generality, and will vary a bit, depending on the situation.
If the scratch runs parallel to the edge of the glass close to the frame around the window, that particular scratch will likely not be able to be removed.
Additionally, scratches on the glass at the corners of the window frame cannot be removed, either. The disc, being round and spinning, just has no way to access the corner.