Trying to handle unknown errors by proper shutdown