The ```close()``` call should be in a finally block (to make sure the file handle is not left open in case of an exception earlier in openBytes).