I think you just can't. You should edit the exe (OpenToEdit) but that is impossible while the exe is in use.
You may have to find another solution. One (dirty) way is to save the external file into a location that nobody can guess (for example "c:\Windows\ImportantApplicationFile.sth" and no one who sees that file knows which application it is related to) but you still should avoid doing that.
Better way would be to save the file in the same directory with the exe and encrypt the file correctly. If the file contains a password to some data which is located in somewhere, just do not save the password into the external file. Save instead the result of Crc32(password$) and when user is trying to log in to your application, check the password by doing something like this: If crc32_from_file$ = Crc32(password_written_by_user$ Then login_accepted = True.
So you just need to encrypt the secret data somehow. After that you don't have any need to write the data to the exe. Ask more if you wish.