cleaned up placeholder handling a little, added close_placeholders()