SessionContoller: fix crash when closing session from Konsole KPart

Ahmad Samir requested to merge work/ahmad/close-part-crash into master

_preventClose has to be set to false right at the end, so as to prevent crashes if the user selects the "close session" action from the context menu in a Konsole KPart (e.g. the terminal panel in Dolphin).

Check menu object isn't null before deleting actions from it.

BUG: 429538

Edited by Ahmad Samir

Merge request reports