test: Fix race in Docker test.

We have to wait for the container to exit before attempting to delete
it.