This is why we recommend generating your monthly masspay.txt file in the last half of each month, ideally as close to the end of the month as possible, to allow time for any Refunds/Reversals to be processed which may affect sales in the last completed calendar month. However, you may still get Reversals over a month after the end of the month when the original sale transpired.
In that case, you could hang onto your masspay files for an extra month before you actually upload the file to PayPal, giving you more time to edit the file if needs be, or you could just edit the following month's masspay file, to manually deduct any commissions earned on late-breaking Reversals. The masspay file format is a simple tab-delimited plaintext file you could edit in Notepad or textEdit or using a spreadsheet program like Excel. You may also want to email affected affiliates to let them know about the manual adjustment, just so there's no misunderstanding or misgivings about it.