If you're "closing" the app by hitting the red button in the upper left corner, you're only closing the window, not the whole app. You need to QUIT the app entirely for it to not appear in the Dock (though some Apple apps actually do completely quit when closing the window).
Now if you are actually Quitting the app, then that is another problem.