When generating thumbnails for a file that was just created and checked in (drag&drop with appropriate FileManager versioning option for instance), the document is nearly immediately re-checked-out because thumbnail generation writes again to the document.
Quotas deal with this properly using doc.putContextData(VersioningService.DISABLE_AUTO_CHECKOUT, Boolean.TRUE) before saveDocument.