remove tmp dir and close(f)