moved button_save_close function to html_output.php and other cleanup