Refactored code (now uses Closeables.closeQuietly())