Solvent vapor annealing (SVA) is known to be a simple, low-cost, and highly efficient technique to produce defect-free diblock copolymer (BCP) thin films. Not only can the solvent weaken the BCP segmental interactions but it can also vary the characteristic spacing of the BCP microstructures. We carry out systematic theoretical studies on the effect of adding a solvent into lamellar BCP thin films on the defect removal close to the BCP order-disorder transition. We find that the increase of the lamellar spacing, as is induced by addition of the solvent, facilitates more efficient removal of defects. The stability of a particular defect in a lamellar BCP thin film is given in terms of two key controllable parameters: the amount of BCP swelling and the solvent-evaporation rate. Our results highlight the SVA mechanism for obtaining defect-free BCP thin films, as is highly desired in nanolithography and other industrial applications.