Gas-Induced Drying of Nanopores