kill directory correctly