Being alone and being lonely to me are two different things. I was never as lonely as I was in one of my marriages, and on the other hand I have lived alone and not been lonely. To me loneliness is a state of mind.
If happiness depends on your being with another person you are wide open to being controlled by that person because they can leave at any time and take away your happiness.
To be happy while being alone is complete freedom because no one can take that from you.