Write to tmp directory