If you are far from a trashcan you can always fold the bag inward into the frame as shown in the pictures below.
This is much easier and more sanitary than trying to tie a knot on a regular poop-filled plastic bag because the side you touch to fold never touches the ground or the waste. Hover over the first picture below to see how it is done. You can then easily carry the in-folded bag as shown in the next pictures.