Frans, last week I noticed this as well. The standard platform functions don't seem to properly release files or folders after upload. We were having windows server issues with the uploaded files folder and we were unable to change or remove the folder after the platform had uploaded a new document (until we stopped the service).
At the time this wasn't a problem for our systems, but I did see the same behavior as you have were you cannot change a document or uploaded files folder. It seems as if the standard functions no longer unlock files. I'm not sure when this started, I had not seen that before. We didn't enter a ticket for this problem yet.
I'm not sure if it would help you with your problem, for another project I also had to 'remove' documents from the application. In this app we did that by resetting the content:
// BEGIN USER CODE
Core.storeFileDocumentContent(getContext(), this.__FileToReset, new ByteArrayInputStream( new byte[0]) );
this.FileToReset.setHasContents(getContext(), false);
Core.commit(getContext(), this.__FileToReset);
return true;
// END USER CODE
I believe nowadays, file system connectors are pluggable (and the Amazon S3 implementation is one example of a plugin). This should allow you to create your own plugin as a wrapper around the default implementation, that would log and pass through.
I doubt what type of info could be logged that would help you though. I would not expect anything like "trying to delete file but couldn't because it was locked by process xyz", or "keeping file abc open because of..." to show up in these logs as I think the Mendix runtime would only be able to know that it could not delete a file because it is still open and have no clue by whom or why.