Added check to ensure GUI thread is alive when testing adding books and displaying the library.