Setting PDF data with JXA does not work

A boiled down version of my script:

const app = Application("DEVONthink 3");
r = app.createRecordWith({name: "DEVONtechnologies", URL:"https://www.devontechnologies.com", type:"bookmark");
let rWindow = app.openWindowFor({record: r});	
app.createRecordWith({name: r.name(), URL:r.url(), type:"PDF document", data: rWindow.pdf()});

Thanks for testing Criss!