To create a shape that closes along the edges of connected shapes, turn on the Automatic Closing toggle button   in the Polygonal Shape Creation tool options 
. Ensure that the  Shapes option 
  is enabled under Snapping. Snap the first point to an edge or vertex of a shape and continue to the last point  where you snap to an edge or vertex that is indirectly or directly connected as shown in the following image:

Note:
- To automatically close shapes, ensure that the toggle button is on before placing the first point.
 - This option is unavailable when the Force New Shape option is enabled.