Fix possible deadlock on sql error on replay
When an exception was thrown while recreating indices during replay, there was a deadlock because one of data processors was waiting on a condition variable that was already destroyed by queries_commit_data_processor. To fix this make sure that all the threads are properly joined and only then propagate exception.
Closes #227 (closed)