Connection timed out errors while creating index

When trying to create a regular index in one my collection using compass or using pymongo , I get this error →
connection 9 to closed
and it fails every time I try
the collection contains around 2m documents and due not having this index any aggregate query using that field fails when I try to run it , and gives Auto reconnect errors

any other useful info on why the connection is closed?

do you see any pattern change on dashboards when you start creating that index?