Close dialogs along with activities - fixes #2503