Fixed #20978 -- MigrationWriter.serialize and closures.