[ticket/12843] Move function closeDarkenWrapper

Move function closeDarkenWrapper in core.js