How come a blocking function within a callback causes node to freeze?