I think in my case the popup is closed because the DataGrid ItemsSource is changed and therefore the selected DataGrid item loses focus.
It would be great, if the popup button could handle such cases somehow, because currently it can only be used for very simple popups. It's useless for more complicated popups because of all the unwanted auto-closes.