Fix logs -f hanging on stopped containers

Fixes #7020