I would suggest an active strategy to deal with the issue instead of a passive one.

1- You have to determine who's holding the library cache lock, that's why I provided the script.
2- You have to determine the status of the holding session and understand why the lock is held; depending of your findings you have to decide either to wait or to terminate the offending session.