Don't leave behind corrupt directories

Ensure that a system `rm -rf target` will continue to work across test runs.