Summary:
This PR ports back into main the changes required to properly close the SonaType repository on Maven
## Changelog
[General] [Fixed] - Close the Maven repository properly
Pull Request resolved: https://github.com/facebook/react-native/pull/35272
Test Plan: We tested these changed in 0.71-stable branch when releasing 0.71.0-RC.0
Reviewed By: christophpurrer
Differential Revision: D41154965
Pulled By: cipolleschi
fbshipit-source-id: 74dd46e8fabf3baef544342282829c70d92f671f