Automaton closes null file handle when terminating process