Intrusion and extrusion of water in hydrophobic nanopores