Windows 7 and file operations

We have a Lotusscript initiated from user mail Inbox which creates a text file, inserts and closes the file. For some reason in Windows 7 file is created but it does not insert anything and when you close it deletes the file becuase its 0 kb. Below is the code which works fine in windows XP and has been working in XP for some years. Its a windows security thing, user has full writes to the folder. Can someone point me twhere i need to tweak stuff?..

fileNum = Freefile()

fileNametxt = “C:\email.txt”

Open fileNametxt For Output As fileNum

Forall header In mime.HeaderObjects

headerstring = walkmime ( mime ) 'calls required function walkmime

Print #fileNum, headerstring

End Forall

Call docA.CloseMIMEEntities 'allow clean switch to using items

Close fileNum