Add auto-closeable bucket wrapper and use try-with-resources