FMenuBuilder not closing after selection

I’m working on creating a context menu in Slate, originally it started as a simple context menu using just simple text like so:

  myMenuBuilder.AddMenuEntry(
				FText::FromString(FString::Printf(TEXT("Entry no. %d"), i)),
				FText(),
				FSlateIcon(), 
                Action);

I then decided to create a custom button class and used that for the buttons in the context menu, this changed the code to something like this:

		myContextMenu->AddWidget(SNew(SButton)
			.OwnerHUD(InArgs._OwnerHUD)
			.OwnerWindow(InArgs._OwnerWindow)
			.EtherButtonText(currButtonLabel)
			.EtherButtonStyle(&myStandardSlateStyle->myContextMenuButtonStyle)
			.EtherButtonTextStyle(&myStandardSlateStyle->myContextMenuButtonTextStyle)
			.EtherButtonTextJustification(ETextJustify::Center)
			.EtherButtonTextMargin(FMargin(0, 20))
			.EtherButtonOnClicked(this, &SEtherContextMenu::OnChoiceSelected, i)
			, FText::GetEmpty()
			, true);

I tried this with SButton as-well to confirm it wasn’t my custom class, using a Widget seems to prevent the context menu from closing even if you pass true to the FMenuBuilder constructor. I confirmed this by trying “AddMenuEntry” and pass it a widget but this also fails.

To fix this I simply have the following code in my context menu class (SEtherContextMenu):

FReply SEtherContextMenu::OnChoiceSelected(int32 choiceIndex)
{
	myOnChoiceSelectedDelegate.Execute(choiceIndex);

	//Close the window since automatic menu closing only works for text and not SWidget.
	if (myCloseAfterSelection == true)
	{
		myPushedMenu->Dismiss();
	}

	return FReply::Handled();
}