hast du file vorher als variable deklariert?
Code:
var file;

function open_NotenDatei()
{
  file = file_open_write("dat.txt");
//  ...
}