Added auto close and fixed field bug