Fix for rsaworker when there's an error in a query.

Previously, an error in the query would prevent the worker from
accepting any future work. Now, the worker transitions to its
idle state and the related pending tasks are removed from the
master's queue.