Core: guard against duplicate dock additions.
Core: readd forcefully closed docks on showing.
Core: removed code duplication.