Eventually is garbaged collected.
It is not a good practice to do this, because you may need to flush the contents of a file to be actually written to disk. By letting the garbage collector do its job when it wants, you're not sure when or whether the file will be actually written.