Buggy code:
public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState . IndexWriterCloser { protected final SolrCoreState solrCoreState ; AtomicLong addCommands = new AtomicLong ( ) ; AtomicLong addCommandsCumulative = new AtomicLong ( ) ; AtomicLong deleteByIdCommands = new AtomicLong ( ) ; AtomicLong deleteByIdCommandsCumulative = new AtomicLong ( ) ; AtomicLong deleteByQueryCommands = new AtomicLong ( ) ; AtomicLong deleteByQueryCommandsCumulative = new AtomicLong ( ) ; AtomicLong expungeDeleteCommands = new AtomicLong ( ) ; AtomicLong mergeIndexesCommands = new AtomicLong ( ) ; AtomicLong commitCommands = new AtomicLong ( ) ; AtomicLong optimizeCommands = new AtomicLong ( ) ; AtomicLong rollbackCommands = new AtomicLong ( ) ; AtomicLong numDocsPending = new AtomicLong ( ) ; AtomicLong numErrors = new AtomicLong ( ) ; AtomicLong numErrorsCumulative = new AtomicLong ( ) ; protected final CommitTracker commitTracker ; protected final CommitTracker softCommitTracker ; protected boolean commitWithinSoftCommit ; public DirectUpdateHandler2 ( SolrCore core ) { } public DirectUpdateHandler2 ( SolrCore core , UpdateHandler updateHandler ) { } private void deleteAll ( ) throws IOException { } protected void rollbackWriter ( ) throws IOException { } @ Override public int addDoc ( AddUpdateCommand cmd ) throws IOException { } private int addDoc0 ( AddUpdateCommand cmd ) throws IOException { } private void updateDeleteTrackers ( DeleteUpdateCommand cmd ) { } @ Override public void delete ( DeleteUpdateCommand cmd ) throws IOException { } public void clearIndex ( ) throws IOException { } private Query getQuery ( DeleteUpdateCommand cmd ) { } @ Override public void deleteByQuery ( DeleteUpdateCommand cmd ) throws IOException { } private void addAndDelete ( AddUpdateCommand cmd , List < Query > dbqList ) throws IOException { } @ Override public int mergeIndexes ( MergeIndexesCommand cmd ) throws IOException { } public void prepareCommit ( CommitUpdateCommand cmd ) throws IOException { } @ Override public void commit ( CommitUpdateCommand cmd ) throws IOException { } @ Override public void newIndexWriter ( boolean rollback ) throws IOException { } @ Override public void rollback ( RollbackUpdateCommand cmd ) throws IOException { } @ Override public UpdateLog getUpdateLog ( ) { } @ Override public void close ( ) throws IOException { } public static boolean commitOnClose = true ; @ Override public void closeWriter ( IndexWriter writer ) throws IOException { boolean clearRequestInfo = false ; solrCoreState . getCommitLock ( ) . lock ( ) ; try { SolrQueryRequest req = new org . apache . solr . request . LocalSolrQueryRequest ( core , new ModifiableSolrParams ( ) ) ; SolrQueryResponse rsp = new SolrQueryResponse ( ) ; if ( ( SolrRequestInfo . getRequestInfo ( ) ) == null ) { clearRequestInfo = true ; SolrRequestInfo . setRequestInfo ( new SolrRequestInfo ( req , rsp ) ) ; } if ( ! ( DirectUpdateHandler2 . commitOnClose ) ) { if ( writer != null ) { writer . rollback ( ) ; } if ( ( ulog ) != null ) ulog . close ( false ) ; return ; } boolean tryToCommit = ( ( ( writer != null ) && ( ( ulog ) != null ) ) && ( ulog . hasUncommittedChanges ( ) ) ) && ( ( ulog . getState ( ) ) == ( State . ACTIVE ) ) ; try { if ( tryToCommit ) { CommitUpdateCommand cmd = new CommitUpdateCommand ( req , false ) ; cmd . openSearcher = false ; cmd . waitSearcher = false ; cmd . softCommit = false ; synchronized ( solrCoreState . getUpdateLock ( ) ) { ulog . preCommit ( cmd ) ; } final Map < String , String > commitData = new HashMap < > ( ) ; commitData . put ( COMMIT_TIME_MSEC_KEY , String . valueOf ( System . currentTimeMillis ( ) ) ) ; writer . setCommitData ( commitData ) ; writer . commit ( ) ; synchronized ( solrCoreState . getUpdateLock ( ) ) { ulog . postCommit ( cmd ) ; } } } catch ( Throwable th ) { log . error ( "Error<seq2seq4repair_space>in<seq2seq4repair_space>final<seq2seq4repair_space>commit" , th ) ; if ( th instanceof OutOfMemoryError ) { throw ( ( OutOfMemoryError ) ( th ) ) ; } } try { if ( ( ulog ) != null ) ulog . close ( false ) ; } catch ( Throwable th ) { log . error ( "Error<seq2seq4repair_space>closing<seq2seq4repair_space>log<seq2seq4repair_space>files" , th ) ; if ( th instanceof OutOfMemoryError ) { throw ( ( OutOfMemoryError ) ( th ) ) ; } } if ( writer != null ) <START_BUG> writer . close ( ) ; <END_BUG> } finally { solrCoreState . getCommitLock ( ) . unlock ( ) ; if ( clearRequestInfo ) SolrRequestInfo . clearRequestInfo ( ) ; } } @ Override public void split ( SplitIndexCommand cmd ) throws IOException { } @ Override public String getName ( ) { } @ Override public String getVersion ( ) { } @ Override public String getDescription ( ) { } @ Override public Category getCategory ( ) { } @ Override public String getSource ( ) { } @ Override public URL [ ] getDocs ( ) { } @ Override public NamedList getStatistics ( ) { } @ Override public String toString ( ) { } @ Override public SolrCoreState getSolrCoreState ( ) { } public CommitTracker getCommitTracker ( ) { } public CommitTracker getSoftCommitTracker ( ) { } }

Fix:
writer . shutdown ( ) ;