AsyncWriteEngine.commit() hangs when writerThread dies

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