Discard any pending result when closing a file.
Log more information about duplicate io operations.
Just in case, also clear results on shutdown.
Merge pull request #5239 from unknownbrackets/io-thread-fix

Fix glitch when a file is closed while its io thread operation is pending