At 'almost' 40, you're definitely not too old to find another partner to share life with, but as a PP said, you need to worry less about 'growing old' being 'lonely', and more about learning what you need and want from any 'relationship.
You have spent years in an abusive relationship, and it may take years for you to fully understand yourself, the things that make you happy.
You don't need to be in another 'relationship' to be happy ! But I think you need to learn this, before you even consider dating again.
After you're divorced, focus on your home, your DC and your happiness. In time, you can build a better relationship with yourself.
I say that because too often women seem to 'define themselves' by what they are to others, rather than what they are to themselves.
i.e Mother, Daughter, Sister, Wife.................but in reality, you can either subjugate yourself to be 'defined' by these 'roles', or you can be true to yourself first, and 'define' these 'roles' to fit you.
In time, you are very likely to meet someone new, and when you do, you need to have already worked out, what it is that you want from any new relationship.(so that you only continue with any relationship because it's right for you)
Does that make sense ?