test: Fix race in Docker test

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

Closes #1334
Reviewed-by: Stef Walter <stefw@redhat.com>