some 'finally' blocks
make richCopy functionality work properly on Linux (IDEA-67767)