Demagnetization following optical excitation in nickel and permalloy films