Added a try/catch block for the InterruptedException.