AsyncWriteEngine.commit() hangs when writerThread dies

By mistake I wanted to insert a non-Serializable object into the Db (kills the writerThread) and call commit right after that but my program hung. This was caused by the loop in AsyncWriteEngine.commit(). This loop should check the writerThread's state in every iteration. Fix included with test.