add support for writing to a local file as well which is deleted when the s3 file is closed