DockerizedInstance: avoid leaking open file descriptors
DockerizedInstance: avoid leaking open file descriptors

Previously, several methods in DockerizedInstance could result in temporary
increases in number of open files. This commit fixes a few known cases.

skeema/tengo,skeema/skeema