Fix possible deadlock on sigint