Fix crashes and deadlocks when running the content tests

r? @metajack