[TEST] Fix testRandomDirectoryIOExceptions to wait for green on reopen & add more assertions
Fix P/C assertions for rewrite reader

Inner queries must be rewritten as soon as a weight is pulled ie. must
be non-null.

Closes #5731