Achim,thank you for your quick reply.I noticed before that snippet of code I tried to create a document by using method 'createDocument(properties, contentStream, VersioningState.MAJOR)' but failed and the stream was not closed,it seems that we have to close the stream manually when failure occurs.Now the issue is fixed!
A big thank to you!