Delete tmp file after checking write access