This is commonly caused by a condition known as "siphoning". The following link explains:
The washer is filled when the solenoids on the water inlet valve are activated, allowing water to flow through the fill hoses. Once the washer reaches a predetermined level (as determined by the load level selector dial), the pressure switch senses the water level and shuts off the inlet valve. If the pressure switch was causing this problem, your water level would continue to rise to the point that the washer would overflow. If the water inlet valve was defective and would not shut off, you not only would have a washer that would potentially overflow, but it would also continue to fill when the washer was not in use. The key to diagnosing your problem is the fact that the washer continually DRAINS and cannot maintain the water level. Take your drain hose and pull it up from the standpipe. If you had the hose shoved down in the standpipe too far, or if the drain hose was fitted too tight, a sucking sound may be heard as you pull the hose out. You should only have about 6 inches of hose in the drain. There needs to an air gap around the top of the standpipe as well. This prevents a vacuum from forming which causes the water to be siphoned from the wash tub.
Read through the link I provided and let me know if you have questions. If you require additional assistance, please let me know before rarting the solution. I hope this helps you.