Bug in Leaked Resources?

I believe I have encountered a bug in Script Debugger’s Leaked Resources detector. Consider the following script, which I believe has correct syntax (and it runs fine in Script Editor) :

set thePath to (path to desktop as Unicode text) & "Wilbur.txt"
set fRef to (open for access thePath with write permission)
set theFile to alias "MacintoshHD:Users:david:Desktop:Wilbur.txt"
close access theFile

Upon running, Script Debugger will report a Leak. The following test indicates an erroneous leak report:

  1. Run the script and cancel out of the resulting Leaked Resources window, so that Script Debugger will not close the leak.
  2. Comment out the second line (which opens access.)
  3. Run the script. Script Debugger reports an error that the file was not open. This indicates that the close access command was executed the first time.

Mac Pro (late 2019)
Script Debugger 8A27
macOS 11.3

As a followup to my bug report. Is it possible to disable the Leaked Resources detector? Perhaps an undocumented preference setting? For what I am doing, specifying the close access file via a file reference is preferable, and I would like to avoid the Leaked Resources message each time the script is run.
Thanks.

You can avoid it like this:

set thePath to (path to desktop as Unicode text) & "Wilbur.txt"
set fRef to (open for access (thePath as «class furl») with write permission)
set theFile to "Macintosh SSD:Users:shane:Desktop:Wilbur.txt" as «class furl»
close access theFile

It’s arguably a bug that your original code works, given you’re actually passing just paths.