Understanding and controlling organic solid-state switches by combining variable temperature and high-pressure crystallography measurements with quantum mechanics studies