Customs and Immigration – Can I return to the United States from the Schengen Area within 90 days of the expiry of my H1B visa?


I got a valid Schengen visa from 7 to 17 October.
My H1b visa expires on December 31st.
In order to respect the rule that my departure date from the Schengen area is exceeded 90 days after the expiry of my H1B visa, I should return to the United States by 30 September.
But can I return to the United States on October 16th?
Will there be a problem (immigration to the United States or leaving the Schengen area) even if I have a visa until October 17th.