Added automatic setting state to finished when type set to error