Adsorption hysteresis in nanopores