Error working for when text field empty and trying to close