prevent ~unique_lock from throwing exceptions

~unique_lock() calls unlock(), which can throw an exception. Destructors may not throw exceptions on pain of immediately terminating the program, so we have to catch the exception.