How can I fix this gap between bookcases I made?
Swap their positions. 

Place the bookcases so that they lean into each other instead of away from each other. This will eliminate the gap between the tops. 

Bookcase contents are usually quite heavy. Once the cases are filled, you will probably find that you can force the bottoms together and the weight of the contents will distort the shape of the cases so the gap disappears. 

If an unsightly gap remains visible then you will need to resort to a decorative molding.