Fix for a bug where the invoices that were already opened, were closed automatically