MessageBox: don't drop a layer if we didn't create it. fixes #3110
Merge remote-tracking branch 'jpab/issue-3110'