When a batch cannot be closed, there may be a duplicate receivable.  

When trying to close the batch in SQL it the error message will tell you the table and the receivable id that has the duplicate number.

The solution is to delete the duplicate record.


It is highly recommended to first back up the database and restore test first. 

Then preform the solution in test first just to confirm before deleting anything in production.