Fix NPE that can occur in stdinClose()