I am trying to create an appendix of tables, but my first table jumps to the second page. I have gone through most of entries on Keeping tables/figures close to where they are mentioned but none of them seem to work.
\documentclass[12pt]{article}
\addtolength{\parskip}{\baselineskip}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage[fleqn]{amsmath}
\usepackage{mathtools}
\usepackage{siunitx}
\setlength{\parindent}{0.25in}
%Tables preamble
\usepackage[none]{hyphenat}
\usepackage{float}
\usepackage[thinlines]{easytable}
\usepackage{longtable}
\usepackage{array,booktabs, makecell, multirow}
\renewcommand\theadfont{\bfseries\small}
\newcommand\mceight[1]{\multicolumn{8}{l}{#1}}
\newcommand\mctwelve[1]{\multicolumn{12}{c}{#1}}
\usepackage{arydshln}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{tabularx}
\widowpenalty500
\clubpenalty500
\exhyphenpenalty=50 %for line-breaking at an explicit hyphen
\brokenpenalty=4991
\predisplaypenalty=10000
\postdisplaypenalty=1549
\displaywidowpenalty=1602
\floatingpenalty = 20000
\usepackage[labelfont=bf, textfont=bf]{caption}
\section{Appendix}
\subsection{Appendix of Tables}
\newgeometry{margin=0.4in}
\begin{table}[!htbp]
\caption{Summary statistics 1}
\fontsize{10}{12}\selectfont
\sisetup{detect-all}
\setlength\tabcolsep{0pt}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
l S[table-format=2.2] S[table-format=2.0]
*{3}{S[table-format=2.2]} S[table-format=3.0]}
\toprule
& & & \multicolumn{3}{c}{Quantiles} \\
\cmidrule(lr){4-6}
\textbf{Variable} & \textbf{Mean} & \textbf{Minimum} & \textbf{25th percentile} & \textbf{Median} & \textbf{75th percentile} & \textbf{Maximum} \\ \midrule
\textbf{Panel A: Female labour force} \\ \midrule
\textbf{2004-05} \\ \hdashline
{Hourly wage} & 12.52 & 0 & 3.75 & 5.48 & 12.5 & 250\ \\ \hdashline
{Age (in years)}& 31.56 & 15 & 22 & 29 & 38 & 60\ \\ \hdashline
{Years of experience} & 7.9 & 0 & 8 & 15 & 25 & 40\ \\ \hdashline
{Years of education} & 17.63 & 0 & 0 & 8 & 12 & 16\ \\ \hdashline
\\
\textbf{2011-12} \\ \hdashline
{Hourly wage} & 29.44 & 1 & 10 & 15 & 30 & 328\ \\ \hdashline
{Age (in years)} & 35.06 & 15 & 28 & 35 & 42 & 60\ \\ \hdashline
{Years of education} & 7.13 & 0 & 0 & 8 & 12 & 16\ \\ \hdashline
{Years of experience} & 21.93 & 0 & 13 & 23 & 31 & 40\ \\ \hdashline
\bottomrule
\end{tabular*}
\end{table}
\end{document}

