Ok so i got a fix.
I am guessing that autocomplete must return false or stop propagation after running whatever function is in the close parameter.
In the code below i have removed the surplus if statement that was in my original code, although even with it left in, this fix works.
$('.mega-menu-search').autocomplete({
source: window.searchTA.split(','),
select: function( event, ui ) {
megaMenuSearchAbort();
megaMenuSearchTimeAndGo();
lastSearch = $(this).val();
},
close: function(event, ui ) {
// Changed code
if(e.target.nodeName != 'A') {
$("#mega-menu-search-results").css("padding-top", "0px");
}
//
}
}).autocomplete("widget").addClass("mega-menu-autocomplete");