nbconvert: Backport fixes

Fixes cherry-picked from Transformer and Writer tests.