How to remove open documents from the dock in Mac OS Catalina
The behavior shown in the image in your OP is the normal default for macOS when application windows are minimized.

If you do not want to see minimized windows in the Dock, then do the following:


Go to System Preferences > Dock and check the&nbsp;&nbsp;&nbsp;&nbsp;   [√] Minimize windows into application icon checkbox.
In Terminal run the following command: killall Dock


This will restore all the application windows so they are not minimized to the Dock.



Now you can minimize the application windows you do not want to currently see and they will minimize into the application's icon on the Dock, not the the normal default position as shown in the image in your OP.

To then access a minimized window, when in the application, you can go to the Window menu on the menu bar, or either click-hold or right-click on the Application's Dock Tile and select the target window.