Webcrawler implementation: Compiles but deadlocks