Currently, Bucket::delete() finds the file document, deletes orphan chunks, conditionally throws a file-not-found exception, and then attempts to delete the files document. Orphan chunk deletion should only happen after an attempted files document deletion, per the spec:
To minimize the window of vulnerability of reading a stored file that is the process of being deleted, drivers MUST first delete the files collection document for a stored file, then delete its associated chunks.
If there is no such file listed in the files collection, drivers MUST raise an error. Drivers MAY attempt to delete any orphaned chunks with files_id equal to id before raising the error.