Raheem Mostert finalizes new contract with 49ers