First off I'll explain what Nate explained to me in the chat:
The pores are indeed a remnant of the lateral lines in fish. The pits contain small hairs that react at the slightest water movement, the cells with the hair are called mechanoreceptive neuromasts(haircells).
I also read that these pores contain ampullary organs(i.e. cells containing electroreceptors)that allows a species to detect natural and artificial electrical fields within one's immediate surroundings. That system is evolutionary later than the mechanoreceptive neuromast system.
Now, what I reacted to after hearing this was that this system reminds me somewhat of the haircells and the tectorial membrane(in the cochlea in the inner ear). The tectorial membrane would be represented by the water. However in the inner ear the haircells are dependent on the liquid around them. They must have liquid and it must be liquid with a certain composition(endolymphatic liquid, high on K+).
The animals will not have any use of the system when terrestrial. Sensory cells are in general protected from the environment due to their innate sensibility - I wonder how these can take it to be exposed to a non-buffered liquid like water....
When going terrestrial some kind of liquid must be retained in these pits or pores to prevent the sensory cells from drying, is it not reasonable to assume that the pores will indeed close? Maybe even produce some endogenous liquid? Then keep closed until the animal enters water and stays there for an extended amount of time.