For the most part, the objects that have Close() and Dispose() methods do so because they use unmanaged Win32 resources, such as files and streams. When I do file I/O, usually in a loop that ends when I have read everything that I need from a file, or written everything I have for it, I try to put the whole loop inside a try/catch/finally block, so that the Close() and Dispose() methods are guaranteed to be called. Since WIL doesn't have try/catch/finally, you will probably need something like the routines I use to close and clean up after regular sequential file I/O, using, e. g., FileRead() and FileWrite(). This involves letting the error handler fall into a block that tests for the existence of filehandle variables, and closes any that are open (nonzero). This block is also the destination of a goto at the bottom of the normal execution path.