More efficient way of creating a temporary file on local file system