__exit__ method not working properly in with multiprocesssing context_manager

Sometime my code is working properly and sometimes it is prematurely exiting and sometimes it is stuck or hang and one thing I had noticed that is not out going outside with statement

with mp.Pool(cpu_count) as p:
        for result in p.starmap(mp_helper, [(2,3), (5,6)]):
        print('finished mp_helper executions')

here print statement doesn’t works when it is stuck or hang.
I want to ask one more thing if with context manager is automatically handling the resource then why it is not going out side the with statement and one more thing i would like to add after adding p.close() and p.join() after for loop my code works properly but I am not getting how it actually resolve the problem