Close handle on IO error