18.104.22.168 Receiving an SMB_COM_CLOSE Request
Upon receipt of an SMB_COM_CLOSE Request (section 22.214.171.124.1), the server MUST confirm that the supplied FID is valid and that it represents a file system object held open by the client. This is done by looking up the FID in Server.Connection.FileOpenTable to find the corresponding Open.
If the Open is not found, the FID is not valid, and the server MUST return an error response to the client with a Status of STATUS_INVALID_HANDLE (ERRDOS/ERRbadfid). The server SHOULD<248> update the last modification time for the file if the value of the SMB_Parameters.Word.LastTimeModified field is neither 0x00000000 nor 0xFFFFFFFF, and the client has write/append access to the file. Then the server MUST decrease Open.TreeConnect.OpenCount and Server.Statistics.sts0_fopens by 1, release the OpLocks by closing the Open indicated by the FID,<249> release every lock in Server.Open.Locks,<250> and invalidate the FID by removing the Open entry from Server.Connection.FileOpenTable. The server MUST provide Open.FileGlobalId as an input parameter and MUST deregister the Open by invoking the Server Deregisters an Open event ([MS-SRVS] section 126.96.36.199).
Once the FID has been invalidated, it is available to be reused by future open or create operations.
The response MUST be sent to the client as specified in section 188.8.131.52.