Given a string containing a set of brackets, determine if the input string is valid and properly closed.