closes on most errors