What you are experiencing is not a bug. The reason you can open a
"deleted" document is that applications can still see the directory entry
for a document that you have put it in the Trash, but not emptied. The
Finder empties the Trash when an application launches.
In your case, you launched your application before dragging the document
into the Trash, so the file still had an entry in the directory. On the
other hand, the Finder knows when you are trying to open a file from the
Trash and displays an error message saying that you should not do so.