Interplay of weak ferromagnetism, ferroelasticity and shape-memory effects in the spin-orbit coupled antiferromagnet K$_2$ReCl$_6$