How can I make sure this method closes the outputstream?
<p>How can I make sure that this method closes the OutputStream so a memory-leak won't happen?</p>

<pre><code>public static void store(Properties properties, Class script) throws IOException {
    ScriptManifest scriptManifest = (ScriptManifest) script.getAnnotation(ScriptManifest.class);
    if (scriptManifest != null) {
        String name = scriptManifest.name();
        FileOutputStream outputStream = new FileOutputStream(Constants.SCRIPT_PROPERTIES_DIR + File.separator + name + ".properties");
        properties.store(outputStream, "");
        outputStream.close();
    } else {
        throw new RuntimeException("Script " + script.getName() + " does not have a ScriptManifest.");
    }
}
</code></pre>