Fix 2 bugs: quit on q key pressing, unlock mutex in VM class