truffle/bin/capture-test-blocks.sh is the script in charge of generating a test blockchain to execute tests. The script in its current state is very naive and simplistic in how it handle error failures.
If for example we want to generate blocks and somehow the testing suite fails, a dangling docker besu image is kept running without being terminated.
A good approach could be using trap signals like this good article explains. So the script is allowed to handle the error and finish its state cleanly.