I store pdf documents as blobs in an sqlite database. This works fine. When I want to see one, I click a button which pulls it out of the database, writes it to disk as a temporary file, and then launch it thus:
f = GetTemporaryFolderItem
f.Name = f.Name + "temp.pdf"
if f.Exists then f.Delete
b=BinaryStream.Create(f)
b.Write rs.Field("pdfocument").NativeValue
b.Close
rs.Close
f.Launch
Now here’s the problem: the first time I click on the button that does all this… nothing happens; the second time (and all subsequent times) it works fine.
I would say its a matter of timing… just because you said “close” doesn’t mean that operation is complete, and the file may still be buffering for a few milliseconds when it tries to launch.
Failing that try immediately opening the file again after the close and see if you encounter an issue if not close that second open and try the launch and see if the problem persists.