Fix issues, switch to context manager regarding hdf5 I/O in inspiral_extrinsics.py
This addresses issues seen in #77 (closed), in which creating new p_of_instruments files with python3 make them unreadable by the same process since the instruments attribute is stored as bytes in python 2 but as a string in python 3. See https://git.ligo.org/lscsoft/gstlal/-/blob/cb7672742b001095ff59ddb618c68f193b359898/gstlal-inspiral/python/stats/inspiral_extrinsics.py#L1890-1891 for the fix if the diff is unclear.
In addition, while addressing this issue, I noticed a lot of the hdf5 file I/O in this module is not using the file context manager for reading/writing hdf5 files which may be problematic in some rare cases, so this merge request also switches to the file context manager rather than opening the file and then closing the file explicitly later.
Closes #77 (closed).