A US man who says he was locked up after crossing into Syria by foot seven months ago has been found safe after rebels liberated the country.