DESC Create a proper error exit path in jopen() to cleanup in case of errors. EDESC If jopen() fails at some point, it should clean up what was previously done, to avoid leaking things. This cleanup is done by calling jclose() internally, which should be perfectly safe. Note that we can only fail _after_ the lock was initialized, so destroying it is OK too (pthread_mutex_init doesn't fail). To do this, the first open() was moved down a bit.