Fixed temporary file cleanup