remove trailing whitespace
shut modal after working