Fix page refresh bug when enter pressed to close modal