fix close error when directory not exists