Compression of the Earth's magnetotail by interplanetary shocks directly drives transient magnetic flux closure