Add error checking to open statements.