I do want my file to be just in-memory file.
Marking a file as temporary and delete-on-close on Windows won't guarantee that it is not written to the file system.
With UNIX / Linux you could create the file in TmpFS or RamFS file system; i.e. a file system that stores files in RAM memory. TmpFS is backed by virtual memory, so some or all of a file in RamFS may end up on the swap disc. RamFS is not backed by virtual memory, and should only ever reside in RAM.
An overview of RamFS and TmpFS can be found here.
Note however that it is possible (at least in theory) for RamFS contents to end up on disc.
If the system is put into hibernate state, the entire contents of RAM is saved to disc before the system is powered down.
If the kernel can be induced to crash and kernel crash dumps are enabled, the contents of kernel memory (probably including the RamFS) will be written to the dump.