shell: Restore the original GLib poll function after running the loop

Otherwise if the loop is restarted it will try to refetch the original
poll function but instead it will just receive the wrapper again. When
the wrapper is later run it will hit an infinite recursion and crash.