Попробуйте
$('li.expanded > ul').not($(this).next()).hide(); //instead of .hide() you can use .slideDown()
$(function () {
$('li.expanded > ul').hide();
$('li.expanded > a').click(function () {
$('li.expanded > ul').not($(this).next()).hide(); //added here
$(this).next().stop(true, true).slideToggle();
});
});