You're getting air in the system and it's getting in the filter and when you shut the pump off the air in the filter is most likely pushing the water back out of the pump basket.
There are some common place's to check. The pump basket lid; inspect, clean, & lube it. The skimmer; make sure it's not creating a vortex, check weir for proper operation and not sticking. Pump basket drain plug; make sure it's not leaking.
If those things don't fix the problem then run water from a hose over the suction plumbing while the pump's running and see if the bubbles go away.