place all stream resources in try-with-resources block to eliminate
resource leak warning