[Core] Fix rare segfault in dock manager.

Fix case where the dock widget is deleted before we restore its width.