Disposable pattern for Scala