A nanoporous molecular magnet with reversible solvent-induced mechanical and magnetic properties