Fix package directory not successfully deleted