Make CloseHandle() clean up the handle, and use it in our examples
Fix order of functions