Question: If I do this in node:

```
console.log('1');
console.log('2');

```

outputs:

```
1
2

```

And the process ends.

If I change it to this:

```
console.log('1');
var Firebase = require('firebase');
var ref = new Firebase('https://<some-base>.firebaseio.com/');
console.log('2');

```

outputs:

```
1
2

```

and the process continues.

I believe that this is because `ref` is keeping the process alive. I know that I can use `process.exit` but I would prefer to not do that. I actually don't want the process to exit anyway, I just want to make sure that I don't have a memory leak issue where my firebase ref lasts forever. Is there any way to destroy a firebase reference once I'm done with it?

Answer: 
[Engineer at Firebase] Currently, instantiating the Firebase client with `new Firebase(...)` will create a long-lived persistent connection that keeps the Node.js process alive.

This is admittedly not ideal for a bunch of use cases, and we have some work to do here to ensure that the process exits cleanly and automatically when there are no outstanding Firebase listeners or pending writes to the server, but it's been medium / low priority. I'd expect a "fix" to be released by Q2 '15, hopefully Q1.
One workaround I found when using [tape](https://github.com/substack/tape "tape") was to call `test.onFinish(() => process.exit());` at the end. It's not ideal but it seems to get the job done running it both directly and with a test runner.

Example:

```
const test = require('tape');

test('Some test', (t) => {
  // test code
});

test('Another test', (t) => {
  // test code
});

test.onFinish(() => process.exit());

```