Fixed closeAll function