Fixing that wrong handle is closed on error in CleanFile